Author: manik.surtani(a)jboss.com
Date: 2008-06-17 19:43:54 -0400 (Tue, 17 Jun 2008)
New Revision: 6000
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/CacheSPI.java
core/branches/2.2.X/src/main/java/org/jboss/cache/DataContainer.java
core/branches/2.2.X/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/branches/2.2.X/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
core/branches/2.2.X/src/main/java/org/jboss/cache/factories/CommandsFactory.java
core/branches/2.2.X/src/main/java/org/jboss/cache/factories/EmptyConstructorFactory.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
core/branches/2.2.X/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/branches/2.2.X/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java
core/branches/2.2.X/src/main/java/org/jboss/cache/notifications/Notifier.java
core/branches/2.2.X/src/main/java/org/jboss/cache/util/CachePrinter.java
Log:
Fixed some ugliness around interfaces introduced for DataContainer and Notifier, as direct
implementations of these were being used instead of the interfaces
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/CacheSPI.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/CacheSPI.java 2008-06-17 23:34:34
UTC (rev 5999)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/CacheSPI.java 2008-06-17 23:43:54
UTC (rev 6000)
@@ -13,7 +13,7 @@
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.marshall.Marshaller;
-import org.jboss.cache.notifications.NotifierImpl;
+import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.statetransfer.StateTransferManager;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
@@ -204,10 +204,10 @@
* From 2.1.0, Interceptor authors should obtain this by injection rather than this
method. See the
* {@link org.jboss.cache.factories.annotations.Inject} annotation.
*
- * @return the notifier attached with this instance of the cache. See {@link
org.jboss.cache.notifications.NotifierImpl}, a class
+ * @return the notifier attached with this instance of the cache. See {@link
org.jboss.cache.notifications.Notifier}, a class
* that is responsible for emitting notifications to registered
CacheListeners.
*/
- NotifierImpl getNotifier();
+ Notifier getNotifier();
/**
* @return the name of the cluster. Null if running in local mode.
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/DataContainer.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/DataContainer.java 2008-06-17
23:34:34 UTC (rev 5999)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/DataContainer.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -158,6 +158,16 @@
int getNumberOfAttributes(Fqn fqn);
/**
+ * Returns an <em>approximation</em> of the total number of attributes in
+ * the cache. Since this method doesn't acquire any locks, the number might
+ * be incorrect, or the method might even throw a
+ * ConcurrentModificationException
+ *
+ * @return number of attribs
+ */
+ int getNumberOfAttributes();
+
+ /**
* Removes the actual node from the tree data structure.
*
* @param f the Fqn of the node to remove
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-06-17
23:34:34 UTC (rev 5999)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -23,7 +23,7 @@
import org.jboss.cache.marshall.CommandAwareRpcDispatcher;
import org.jboss.cache.marshall.InactiveRegionAwareRpcDispatcher;
import org.jboss.cache.marshall.Marshaller;
-import org.jboss.cache.notifications.NotifierImpl;
+import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.remoting.jgroups.ChannelMessageListener;
import org.jboss.cache.statetransfer.StateTransferManager;
import org.jboss.cache.transaction.GlobalTransaction;
@@ -82,7 +82,7 @@
*/
private ChannelMessageListener messageListener;
private Configuration configuration;
- private NotifierImpl notifier;
+ private Notifier notifier;
private CacheSPI spi;
private InvocationContextContainer invocationContextContainer;
private final boolean trace = log.isTraceEnabled();
@@ -97,7 +97,7 @@
private LockManager lockManager;
@Inject
- private void setupDependencies(ChannelMessageListener messageListener, Configuration
configuration, NotifierImpl notifier,
+ private void setupDependencies(ChannelMessageListener messageListener, Configuration
configuration, Notifier notifier,
CacheSPI spi, Marshaller marshaller, TransactionTable
txTable,
TransactionManager txManager,
InvocationContextContainer container, InterceptorChain interceptorChain,
ComponentRegistry componentRegistry, LockManager
lockManager)
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -10,7 +10,7 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
-import org.jboss.cache.DataContainerImpl;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
import org.jboss.cache.RPCManager;
@@ -32,7 +32,7 @@
import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.factories.annotations.Stop;
import org.jboss.cache.lock.TimeoutException;
-import org.jboss.cache.notifications.NotifierImpl;
+import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.notifications.annotation.CacheListener;
import org.jboss.cache.notifications.annotation.ViewChanged;
import org.jboss.cache.notifications.event.ViewChangedEvent;
@@ -79,7 +79,7 @@
private CacheSPI<?, ?> cache;
private Configuration configuration;
private RegionManager regionManager;
- private NotifierImpl notifier;
+ private Notifier notifier;
private StateTransferManager stateTransferManager;
private RPCManager rpcManager;
/**
@@ -142,7 +142,7 @@
private ViewChangeListener viewChangeListener; // the view-change viewChangeListener
private boolean receivedBuddyInfo;
- private DataContainerImpl dataContainer;
+ private DataContainer dataContainer;
private BuddyFqnTransformer buddyFqnTransformer;
public BuddyManager()
@@ -181,8 +181,8 @@
@Inject
public void injectDependencies(CacheSPI cache, Configuration configuration,
RegionManager regionManager,
- StateTransferManager stateTransferManager, RPCManager
rpcManager, NotifierImpl notifier,
- CommandsFactory factory, DataContainerImpl
dataContainer, BuddyFqnTransformer transformer)
+ StateTransferManager stateTransferManager, RPCManager
rpcManager, Notifier notifier,
+ CommandsFactory factory, DataContainer dataContainer,
BuddyFqnTransformer transformer)
{
this.cache = cache;
this.configuration = configuration;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -2,7 +2,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.DataContainerImpl;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.DataCommand;
import org.jboss.cache.commands.ReplicableCommand;
@@ -30,7 +30,7 @@
private DataCommand dataCommand;
private boolean searchBackupSubtrees;
- private DataContainerImpl dataContainer;
+ private DataContainer dataContainer;
private InterceptorChain interceptorChain;
private static final Log log = LogFactory.getLog(ClusteredGetCommand.class);
@@ -46,7 +46,7 @@
{
}
- public void initialize(DataContainerImpl dataContainer, InterceptorChain
interceptorChain)
+ public void initialize(DataContainer dataContainer, InterceptorChain
interceptorChain)
{
this.dataContainer = dataContainer;
this.interceptorChain = interceptorChain;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -2,7 +2,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.DataContainerImpl;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
@@ -38,7 +38,7 @@
private TransactionTable transactionTable;
private InterceptorChain invoker;
private CommandsFactory commandsFactory;
- private DataContainerImpl dataContainer;
+ private DataContainer dataContainer;
/* parameters */
private GlobalTransaction globalTransaction;
@@ -58,7 +58,7 @@
}
public void initialize(BuddyManager buddyManager, InterceptorChain invoker,
TransactionTable transactionTable,
- CommandsFactory commandsFactory, DataContainerImpl
dataContainer, BuddyFqnTransformer buddyFqnTransformer)
+ CommandsFactory commandsFactory, DataContainer dataContainer,
BuddyFqnTransformer buddyFqnTransformer)
{
this.buddyManager = buddyManager;
this.invoker = invoker;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/factories/CommandsFactory.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/factories/CommandsFactory.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/factories/CommandsFactory.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -2,12 +2,12 @@
import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
-import org.jboss.cache.DataContainerImpl;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.RPCManager;
+import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyGroup;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.commands.DataCommand;
import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.ReversibleCommand;
@@ -18,7 +18,12 @@
import org.jboss.cache.commands.read.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
-import org.jboss.cache.commands.remote.*;
+import org.jboss.cache.commands.remote.AnnounceBuddyPoolNameCommand;
+import org.jboss.cache.commands.remote.AssignToBuddyGroupCommand;
+import org.jboss.cache.commands.remote.ClusteredGetCommand;
+import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
+import org.jboss.cache.commands.remote.RemoveFromBuddyGroupCommand;
+import org.jboss.cache.commands.remote.ReplicateCommand;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
@@ -28,7 +33,7 @@
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.NonVolatile;
import org.jboss.cache.interceptors.InterceptorChain;
-import org.jboss.cache.notifications.NotifierImpl;
+import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
import org.jgroups.Address;
@@ -54,8 +59,8 @@
public class CommandsFactory
{
private RPCManager rpcManager;
- private DataContainerImpl dataContainer;
- private NotifierImpl notifier;
+ private DataContainer dataContainer;
+ private Notifier notifier;
private InterceptorChain invoker;
private BuddyManager buddyManager;
private TransactionTable transactionTable;
@@ -69,7 +74,7 @@
}
@Inject
- public void initialize(RPCManager rpc, DataContainerImpl dataContainer, NotifierImpl
notifier, BuddyManager buddyManager,
+ public void initialize(RPCManager rpc, DataContainer dataContainer, Notifier notifier,
BuddyManager buddyManager,
InterceptorChain invoker, TransactionTable transactionTable,
CacheSPI cacheSpi,
Configuration configuration, TransactionManager txManager,
BuddyFqnTransformer buddyFqnTransformer)
{
@@ -178,7 +183,8 @@
command.initialize(txManager);
command.initialize(cacheSpi, dataContainer, notifier);
return command;
- } else
+ }
+ else
{
InvalidateCommand command = new InvalidateCommand(fqn);
command.initialize(cacheSpi, dataContainer, notifier);
@@ -450,7 +456,8 @@
returnValue.initialize(txManager);
returnValue.initialize(cacheSpi, dataContainer, notifier);
command = returnValue;
- } else
+ }
+ else
{
InvalidateCommand returnValue = new InvalidateCommand();
returnValue.initialize(cacheSpi, dataContainer, notifier);
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/factories/EmptyConstructorFactory.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/factories/EmptyConstructorFactory.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/factories/EmptyConstructorFactory.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -1,6 +1,6 @@
package org.jboss.cache.factories;
-import org.jboss.cache.DataContainerImpl;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.RegionManager;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.config.ConfigurationException;
@@ -11,7 +11,7 @@
import org.jboss.cache.lock.LockStrategyFactory;
import org.jboss.cache.marshall.Marshaller;
import org.jboss.cache.marshall.VersionAwareMarshaller;
-import org.jboss.cache.notifications.NotifierImpl;
+import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.remoting.jgroups.ChannelMessageListener;
import org.jboss.cache.statetransfer.StateTransferManager;
import org.jboss.cache.transaction.TransactionTable;
@@ -22,9 +22,9 @@
* @author Manik Surtani (<a
href="mailto:manik@jboss.org">manik@jboss.org</a>)
* @since 2.1.0
*/
-@DefaultFactoryFor(classes = {StateTransferManager.class, RegionManager.class,
NotifierImpl.class,
+@DefaultFactoryFor(classes = {StateTransferManager.class, RegionManager.class,
Notifier.class,
ChannelMessageListener.class, CacheLoaderManager.class, Marshaller.class,
InvocationContextContainer.class,
- CacheInvocationDelegate.class, TransactionTable.class, DataContainerImpl.class,
CommandsFactory.class,
+ CacheInvocationDelegate.class, TransactionTable.class, DataContainer.class,
CommandsFactory.class,
LockStrategyFactory.class, BuddyFqnTransformer.class})
public class EmptyConstructorFactory extends ComponentFactory
{
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -1,7 +1,7 @@
package org.jboss.cache.interceptors;
import org.jboss.cache.CacheException;
-import org.jboss.cache.DataContainerImpl;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
@@ -29,7 +29,7 @@
import org.jboss.cache.lock.LockManager;
import org.jboss.cache.lock.LockType;
import org.jboss.cache.lock.TimeoutException;
-import org.jboss.cache.notifications.NotifierImpl;
+import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.transaction.TransactionEntry;
import org.jboss.cache.transaction.TransactionTable;
@@ -55,8 +55,8 @@
protected TransactionTable txTable = null;
protected CacheLoader loader;
- protected DataContainerImpl dataContainer;
- protected NotifierImpl notifier;
+ protected DataContainer dataContainer;
+ protected Notifier notifier;
protected boolean isActivation = false;
protected boolean usingOptimisticInvalidation = false;
@@ -71,7 +71,7 @@
@Inject
protected void injectDependencies(TransactionTable txTable, CacheLoaderManager clm,
Configuration configuration,
- DataContainerImpl dataContainer, LockManager
lockManager, NotifierImpl notifier)
+ DataContainer dataContainer, LockManager
lockManager, Notifier notifier)
{
this.txTable = txTable;
this.clm = clm;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.interceptors;
-import org.jboss.cache.DataContainerImpl;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.read.GetKeyValueCommand;
import org.jboss.cache.commands.write.EvictCommand;
@@ -52,10 +52,10 @@
private long m_start = System.currentTimeMillis();
private long m_reset = m_start;
- private DataContainerImpl dataContainer;
+ private DataContainer dataContainer;
@Inject
- public void setDependencies(DataContainerImpl dataContainer)
+ public void setDependencies(DataContainer dataContainer)
{
this.dataContainer = dataContainer;
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -1,7 +1,7 @@
package org.jboss.cache.interceptors;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.DataContainerImpl;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Modification;
@@ -14,7 +14,12 @@
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
-import org.jboss.cache.commands.write.*;
+import org.jboss.cache.commands.write.MoveCommand;
+import org.jboss.cache.commands.write.PutDataMapCommand;
+import org.jboss.cache.commands.write.PutForExternalReadCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.commands.write.RemoveKeyCommand;
+import org.jboss.cache.commands.write.RemoveNodeCommand;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.Start;
@@ -49,7 +54,7 @@
private Map<GlobalTransaction, Set<Fqn>> preparingTxs = new
ConcurrentHashMap<GlobalTransaction, Set<Fqn>>();
private long cacheStores = 0;
private CacheLoader loader;
- private DataContainerImpl dataContainer;
+ private DataContainer dataContainer;
private CacheLoaderManager loaderManager;
public CacheStoreInterceptor()
@@ -59,7 +64,7 @@
}
@Inject
- protected void init(DataContainerImpl dataContainer, CacheLoaderManager loaderManager,
TransactionManager txManager, CacheLoaderConfig clConfig)
+ protected void init(DataContainer dataContainer, CacheLoaderManager loaderManager,
TransactionManager txManager, CacheLoaderConfig clConfig)
{
// never inject a CacheLoader at this stage - only a CacheLoaderManager, since the
CacheLoaderManager only creates a CacheLoader instance when it @Starts.
this.loaderManager = loaderManager;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -6,13 +6,23 @@
*/
package org.jboss.cache.interceptors;
-import org.jboss.cache.*;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.buddyreplication.GravitateResult;
import org.jboss.cache.commands.DataCommand;
import org.jboss.cache.commands.ReplicableCommand;
-import org.jboss.cache.commands.read.*;
+import org.jboss.cache.commands.read.ExistsCommand;
+import org.jboss.cache.commands.read.GetChildrenNamesCommand;
+import org.jboss.cache.commands.read.GetDataMapCommand;
+import org.jboss.cache.commands.read.GetKeyValueCommand;
+import org.jboss.cache.commands.read.GetKeysCommand;
+import org.jboss.cache.commands.read.GetNodeCommand;
+import org.jboss.cache.commands.read.GravitateDataCommand;
import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
@@ -59,13 +69,13 @@
* cleanup commands corresponding to all gravitate calls made during the course of the
transaction in question.
*/
private Map<GlobalTransaction, List<ReplicableCommand>> cleanupCommands =
new ConcurrentHashMap<GlobalTransaction, List<ReplicableCommand>>();
- private DataContainerImpl dataContainer;
+ private DataContainer dataContainer;
private CommandsFactory commandsFactory;
private CacheSPI cacheSPI;
private BuddyFqnTransformer buddyFqnTransformer;
@Inject
- public void injectComponents(BuddyManager buddyManager, DataContainerImpl
dataContainer, CommandsFactory commandsFactory, CacheSPI cacheSPI, BuddyFqnTransformer
transformer)
+ public void injectComponents(BuddyManager buddyManager, DataContainer dataContainer,
CommandsFactory commandsFactory, CacheSPI cacheSPI, BuddyFqnTransformer transformer)
{
this.buddyManager = buddyManager;
this.dataContainer = dataContainer;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -7,7 +7,7 @@
*/
package org.jboss.cache.interceptors;
-import org.jboss.cache.DataContainerImpl;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
@@ -17,7 +17,12 @@
import org.jboss.cache.commands.read.GetKeyValueCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
-import org.jboss.cache.commands.write.*;
+import org.jboss.cache.commands.write.EvictCommand;
+import org.jboss.cache.commands.write.PutDataMapCommand;
+import org.jboss.cache.commands.write.PutForExternalReadCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.commands.write.RemoveKeyCommand;
+import org.jboss.cache.commands.write.RemoveNodeCommand;
import org.jboss.cache.eviction.EvictedEventNode;
import org.jboss.cache.eviction.NodeEventType;
import org.jboss.cache.factories.annotations.Inject;
@@ -36,10 +41,10 @@
{
protected RegionManager regionManager;
- private DataContainerImpl dataContainer;
+ private DataContainer dataContainer;
@Inject
- public void initialize(DataContainerImpl dataContainer)
+ public void initialize(DataContainer dataContainer)
{
this.dataContainer = dataContainer;
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -5,7 +5,7 @@
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.notifications.NotifierImpl;
+import org.jboss.cache.notifications.Notifier;
/**
* The interceptor in charge of firing off notifications to cache listeners
@@ -15,10 +15,10 @@
*/
public class NotificationInterceptor extends BaseTransactionalContextInterceptor
{
- private NotifierImpl notifier;
+ private Notifier notifier;
@Inject
- public void injectDependencies(NotifierImpl notifier)
+ public void injectDependencies(Notifier notifier)
{
this.notifier = notifier;
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -8,7 +8,7 @@
import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
-import org.jboss.cache.DataContainerImpl;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeFactory;
@@ -46,14 +46,14 @@
*/
private NodeFactory nodeFactory;
- private DataContainerImpl dataContainer;
+ private DataContainer dataContainer;
private CacheSPI cache;
private long lockAcquisitionTimeout;
@Inject
- private void injectDependencies(NodeFactory nodeFactory, DataContainerImpl
dataContainer, CacheSPI cacheSPI)
+ private void injectDependencies(NodeFactory nodeFactory, DataContainer dataContainer,
CacheSPI cacheSPI)
{
this.nodeFactory = nodeFactory;
this.dataContainer = dataContainer;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -8,7 +8,7 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheException;
-import org.jboss.cache.DataContainerImpl;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeFactory;
@@ -20,17 +20,17 @@
import org.jboss.cache.commands.read.GetKeyValueCommand;
import org.jboss.cache.commands.read.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
+import org.jboss.cache.commands.write.ClearDataCommand;
import org.jboss.cache.commands.write.MoveCommand;
import org.jboss.cache.commands.write.PutDataMapCommand;
import org.jboss.cache.commands.write.PutForExternalReadCommand;
import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.commands.write.ClearDataCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
import org.jboss.cache.config.Option;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.notifications.NotifierImpl;
+import org.jboss.cache.notifications.Notifier;
import static org.jboss.cache.notifications.event.NodeModifiedEvent.ModificationType.*;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.optimistic.DefaultDataVersion;
@@ -56,12 +56,12 @@
* Needed for the creation of workspace nodes based on underlying nodes in the cache.
*/
private NodeFactory nodeFactory;
- private NotifierImpl notifier;
- private DataContainerImpl dataContainer;
+ private Notifier notifier;
+ private DataContainer dataContainer;
private long lockAcquisitionTimeout;
@Inject
- protected void injectDependencies(NotifierImpl notifier, NodeFactory nodeFactory,
DataContainerImpl dataContainer)
+ protected void injectDependencies(Notifier notifier, NodeFactory nodeFactory,
DataContainer dataContainer)
{
this.notifier = notifier;
this.nodeFactory = nodeFactory;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -6,8 +6,11 @@
*/
package org.jboss.cache.interceptors;
-import org.jboss.cache.DataContainerImpl;
-import org.jboss.cache.*;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
@@ -47,10 +50,10 @@
{
private boolean useTombstones;
- private DataContainerImpl dataContainer;
+ private DataContainer dataContainer;
@Inject
- public void initialize(DataContainerImpl dataContainer)
+ public void initialize(DataContainer dataContainer)
{
this.dataContainer = dataContainer;
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -1,6 +1,6 @@
package org.jboss.cache.interceptors;
-import org.jboss.cache.DataContainerImpl;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
@@ -9,7 +9,7 @@
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.CacheLoaderManager;
-import org.jboss.cache.notifications.NotifierImpl;
+import org.jboss.cache.notifications.Notifier;
import java.util.Collections;
import java.util.HashMap;
@@ -30,11 +30,11 @@
private final AtomicLong passivations = new AtomicLong(0);
protected CacheLoader loader;
- private NotifierImpl notifier;
- private DataContainerImpl dataContainer;
+ private Notifier notifier;
+ private DataContainer dataContainer;
@Inject
- public void setDependencies(NotifierImpl notifier, DataContainerImpl dataContainer,
CacheLoaderManager loaderManager)
+ public void setDependencies(Notifier notifier, DataContainer dataContainer,
CacheLoaderManager loaderManager)
{
this.notifier = notifier;
this.dataContainer = dataContainer;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -6,7 +6,7 @@
*/
package org.jboss.cache.interceptors;
-import org.jboss.cache.DataContainerImpl;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
@@ -62,12 +62,12 @@
*/
public class PessimisticLockInterceptor extends PostProcessingCommandInterceptor
{
- private DataContainerImpl dataContainer;
+ private DataContainer dataContainer;
private PessimisticNodeBasedLockManager lockManager;
private CommandsFactory commandsFactory;
@Inject
- public void injectDependencies(DataContainerImpl dataContainer, LockManager
lockManager, CommandsFactory commandsFactory)
+ public void injectDependencies(DataContainer dataContainer, LockManager lockManager,
CommandsFactory commandsFactory)
{
this.dataContainer = dataContainer;
this.lockManager = (PessimisticNodeBasedLockManager) lockManager;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -31,7 +31,7 @@
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.InvocationContextContainer;
import org.jboss.cache.lock.LockManager;
-import org.jboss.cache.notifications.NotifierImpl;
+import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionEntry;
import org.jboss.cache.transaction.TransactionTable;
@@ -63,7 +63,7 @@
{
protected CommandsFactory commandsFactory;
protected RPCManager rpcManager;
- private NotifierImpl notifier;
+ private Notifier notifier;
private InvocationContextContainer invocationContextContainer;
private ComponentRegistry componentRegistry;
@@ -80,7 +80,7 @@
@Inject
public void intialize(RPCManager rpcManager,
- NotifierImpl notifier, InvocationContextContainer icc,
+ Notifier notifier, InvocationContextContainer icc,
CommandsFactory factory, ComponentRegistry componentRegistry,
LockManager lockManager)
{
this.commandsFactory = factory;
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -24,7 +24,7 @@
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.marshall.Marshaller;
-import org.jboss.cache.notifications.NotifierImpl;
+import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.statetransfer.StateTransferManager;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
@@ -52,21 +52,21 @@
// this stuff is needed since the SPI has methods to retrieve these.
private StateTransferManager stateTransferManager;
private CacheLoaderManager cacheLoaderManager;
- private NotifierImpl notifier;
+ private Notifier notifier;
private TransactionManager transactionManager;
private BuddyManager buddyManager;
private TransactionTable transactionTable;
private RPCManager rpcManager;
private RegionManager regionManager;
private Marshaller marshaller;
- private DataContainerImpl dataContainer;
+ private DataContainer dataContainer;
private CommandsFactory commandsFactory;
@Inject
- public void initialize(StateTransferManager stateTransferManager, CacheLoaderManager
cacheLoaderManager, NotifierImpl notifier,
+ public void initialize(StateTransferManager stateTransferManager, CacheLoaderManager
cacheLoaderManager, Notifier notifier,
TransactionManager transactionManager, BuddyManager
buddyManager, TransactionTable transactionTable,
RPCManager rpcManager, RegionManager regionManager, Marshaller
marshaller,
- CommandsFactory commandsFactory, DataContainerImpl
dataContainer)
+ CommandsFactory commandsFactory, DataContainer dataContainer)
{
this.stateTransferManager = stateTransferManager;
this.cacheLoaderManager = cacheLoaderManager;
@@ -215,7 +215,7 @@
return peek(fqn, false, false) != null;
}
- public NotifierImpl getNotifier()
+ public Notifier getNotifier()
{
return notifier;
}
@@ -560,7 +560,7 @@
return getChildrenNames(Fqn.fromString(fqn));
}
- public DataContainerImpl getDataContainer()
+ public DataContainer getDataContainer()
{
return dataContainer;
}
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -2,7 +2,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.DataContainerImpl;
+import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
@@ -26,11 +26,11 @@
protected Configuration configuration;
protected long lockAcquisitionTimeout;
- protected DataContainerImpl dataContainer;
+ protected DataContainer dataContainer;
protected NodeSPI rootNode;
@Inject
- public void inject(Configuration configuration, DataContainerImpl dataContainer)
+ public void inject(Configuration configuration, DataContainer dataContainer)
{
this.configuration = configuration;
this.dataContainer = dataContainer;
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/notifications/Notifier.java
===================================================================
---
core/branches/2.2.X/src/main/java/org/jboss/cache/notifications/Notifier.java 2008-06-17
23:34:34 UTC (rev 5999)
+++
core/branches/2.2.X/src/main/java/org/jboss/cache/notifications/Notifier.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -2,19 +2,17 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.buddyreplication.BuddyGroup;
-import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.factories.annotations.Stop;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.jgroups.View;
import javax.transaction.Transaction;
import java.util.Map;
+import java.util.Set;
/**
* Public interface with all allowed notifications.
- *
+ *
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
@@ -33,7 +31,7 @@
/**
* When notifying about node modifications, in many scenarios there is a need of
building a new Map object. If no
* listeners are registered for notification then it is pointless building this object
- so guard the notification
- * with this call.
+ * with this call.
*/
public boolean shouldNotifyOnNodeModified();
@@ -102,7 +100,36 @@
*/
void notifyTransactionRegistered(Transaction transaction, InvocationContext ctx);
+ /**
+ * Notify that a cache has been blocked
+ *
+ * @param pre
+ */
void notifyCacheBlocked(boolean pre);
+ /**
+ * Notify that a cache has been unblocked
+ *
+ * @param pre
+ */
void notifyCacheUnblocked(boolean pre);
+
+ /**
+ * Adds a cache listener to the list of cache listeners registered.
+ *
+ * @param listener
+ */
+ void addCacheListener(Object listener);
+
+ /**
+ * Removes a cache listener from the list of cache listeners registered.
+ *
+ * @param listener
+ */
+ void removeCacheListener(Object listener);
+
+ /**
+ * @return Retrieves an (unmodifiable) set of cache listeners registered.
+ */
+ Set<Object> getCacheListeners();
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/util/CachePrinter.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/util/CachePrinter.java 2008-06-17
23:34:34 UTC (rev 5999)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/util/CachePrinter.java 2008-06-17
23:43:54 UTC (rev 6000)
@@ -23,7 +23,7 @@
public static String printCacheDetails(Cache c)
{
// internal cast
- DataContainerImpl ci = ((CacheInvocationDelegate) c).getDataContainer();
+ DataContainerImpl ci = (DataContainerImpl) ((CacheInvocationDelegate)
c).getDataContainer();
return ci.printDetails();
}
@@ -36,7 +36,7 @@
public static String printCacheLockingInfo(Cache c)
{
// internal cast
- DataContainerImpl cd = ((CacheInvocationDelegate) c).getDataContainer();
+ DataContainerImpl cd = (DataContainerImpl) ((CacheInvocationDelegate)
c).getDataContainer();
return cd.printLockInfo();
}