JBoss Cache SVN: r5553 - core/trunk/src/main/java/org/jboss/cache/commands/cachedata.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-04-14 10:50:03 -0400 (Mon, 14 Apr 2008)
New Revision: 5553
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/InvalidateCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java
Log:
Added method ids
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/InvalidateCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/InvalidateCommand.java 2008-04-14 14:49:47 UTC (rev 5552)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/InvalidateCommand.java 2008-04-14 14:50:03 UTC (rev 5553)
@@ -2,7 +2,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.*;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.Node;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.CommandsVisitor;
import org.jboss.cache.config.Option;
import org.jboss.cache.factories.annotations.Inject;
@@ -30,6 +35,8 @@
*/
public class InvalidateCommand extends EvictFqnCommand
{
+ public static final int METHOD_ID = 47;
+
private static final Log log = LogFactory.getLog(InvalidateCommand.class);
/* dependencies*/
@@ -145,8 +152,29 @@
return handler.handleInvalidateCommand(ctx, this);
}
- public DataVersion getVersionToInvalidate()
+ @Override
+ public boolean isVersioned()
{
- return dataVersion;
+ // invalidate commands are *always* versioned.
+ return true;
}
+
+ @Override
+ public int getCommandId()
+ {
+ return METHOD_ID;
+ }
+
+ @Override
+ public Object[] getParameters()
+ {
+ return new Object[]{fqn, dataVersion};
+ }
+
+ @Override
+ public void setState(int commandId, Object[] args)
+ {
+ fqn = (Fqn) args[0];
+ dataVersion = (DataVersion) args[1];
+ }
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java 2008-04-14 14:49:47 UTC (rev 5552)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java 2008-04-14 14:50:03 UTC (rev 5553)
@@ -7,9 +7,9 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.BaseCommand;
import org.jboss.cache.commands.CommandsVisitor;
+import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.commands.state.DataVersionCommand;
import org.jboss.cache.commands.state.GlobalTransactionCommand;
-import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.notifications.Notifier;
@@ -30,6 +30,8 @@
{
public static final int METHOD_ID = 1;
public static final int ERASE_METHOD_ID = 2;
+ public static final int VERSIONED_METHOD_ID = 37;
+ public static final int ERASE_VERSIONED_METHOD_ID = 38;
private static Log log = LogFactory.getLog(PutDataMapCommand.class);
@@ -162,12 +164,22 @@
public int getCommandId()
{
- return eraseContents ? ERASE_METHOD_ID : METHOD_ID;
+ if (isVersioned())
+ {
+ return eraseContents ? ERASE_VERSIONED_METHOD_ID : VERSIONED_METHOD_ID;
+ }
+ else
+ {
+ return eraseContents ? ERASE_METHOD_ID : METHOD_ID;
+ }
}
public Object[] getParameters()
{
- return new Object[]{globalTransaction, fqn, data, createUndoOps};
+ if (isVersioned())
+ return new Object[]{globalTransaction, fqn, data, createUndoOps, dataVersion};
+ else
+ return new Object[]{globalTransaction, fqn, data, createUndoOps};
}
public void setState(int commandId, Object[] args)
@@ -177,5 +189,7 @@
data = (Map) args[2];
createUndoOps = (Boolean) args[3];
eraseContents = commandId == ERASE_METHOD_ID;
+ if (commandId == VERSIONED_METHOD_ID || commandId == ERASE_VERSIONED_METHOD_ID)
+ dataVersion = (DataVersion) args[4];
}
}
16 years, 2 months
JBoss Cache SVN: r5552 - core/trunk/src/main/java/org/jboss/cache/commands/channel.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-04-14 10:49:47 -0400 (Mon, 14 Apr 2008)
New Revision: 5552
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/channel/UnblockChannelCommand.java
Log:
Added method id
Modified: core/trunk/src/main/java/org/jboss/cache/commands/channel/UnblockChannelCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/channel/UnblockChannelCommand.java 2008-04-14 14:41:49 UTC (rev 5551)
+++ core/trunk/src/main/java/org/jboss/cache/commands/channel/UnblockChannelCommand.java 2008-04-14 14:49:47 UTC (rev 5552)
@@ -14,7 +14,7 @@
*/
public class UnblockChannelCommand extends BaseCommand implements CacheCommand
{
- public static final int METHOD_ID = 43;
+ public static final int METHOD_ID = 44;
public UnblockChannelCommand()
{
16 years, 2 months
JBoss Cache SVN: r5551 - core/trunk/src/test/java/org/jboss/cache/marshall.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-04-14 10:41:49 -0400 (Mon, 14 Apr 2008)
New Revision: 5551
Added:
core/trunk/src/test/java/org/jboss/cache/marshall/BackwardCompatTest.java
Log:
Added a manual test to dump command serialization info
Added: core/trunk/src/test/java/org/jboss/cache/marshall/BackwardCompatTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/BackwardCompatTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/BackwardCompatTest.java 2008-04-14 14:41:49 UTC (rev 5551)
@@ -0,0 +1,140 @@
+package org.jboss.cache.marshall;
+
+import org.jboss.cache.commands.EvictNodeCommand;
+import org.jboss.cache.commands.GravitateDataCommand;
+import org.jboss.cache.commands.InvalidateCommand;
+import org.jboss.cache.commands.MarshallableCommand;
+import org.jboss.cache.commands.cachedata.*;
+import org.jboss.cache.commands.channel.BlockChannelCommand;
+import org.jboss.cache.commands.channel.UnblockChannelCommand;
+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;
+import org.jboss.cache.commands.tx.RollbackCommand;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+/**
+ * A simple test that ensures wire level compatibility of method ids and parameters between 2.1.0 and 2.2.0 (onwards).
+ * <p/>
+ * Sadly, this test cannot be automated easily.
+ *
+ * @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
+ * @since 2.2.0
+ */
+@Test(groups = "manual")
+public class BackwardCompatTest
+{
+ private SortedMap<Integer, Field> fieldMap = new TreeMap<Integer, Field>();
+ private List<Integer> unusedIds;
+ private SortedMap<Integer, Class<? extends MarshallableCommand>> commands = new TreeMap<Integer, Class<? extends MarshallableCommand>>();
+
+ @BeforeTest
+ public void setUp() throws Exception
+ {
+ Field[] fields = MethodDeclarations.class.getFields();
+ for (Field f : fields)
+ {
+ if (f.getName().endsWith("_id"))
+ {
+ // this is a method id.
+ Integer fieldValue = (Integer) f.get(MethodDeclarations.class);
+ fieldMap.put(fieldValue, f);
+ }
+ }
+
+ System.out.println("Map size: " + fieldMap.size());
+
+ // unused IDs. For some reason or the other these were not used in JBoss Cache 2.1.0, but may have been used in prior versions.
+ // as such they should never be used in this or future versions.
+ Integer[] unusedIdArray = {0, 4, 15, 17, 19, 20, 21, 27, 32, 33};
+ unusedIds = Arrays.asList(unusedIdArray);
+
+ // initialise all commands
+ commands.put(ExistsNodeCommand.METHOD_ID, ExistsNodeCommand.class);
+ commands.put(GetChildrenNamesCommand.METHOD_ID, GetChildrenNamesCommand.class);
+ commands.put(GetDataMapCommand.METHOD_ID, GetDataMapCommand.class);
+ commands.put(GetKeysCommand.METHOD_ID, GetKeysCommand.class);
+ commands.put(GetKeyValueCommand.METHOD_ID, GetKeyValueCommand.class);
+ commands.put(GetNodeCommand.METHOD_ID, GetNodeCommand.class);
+ commands.put(MoveCommand.METHOD_ID, MoveCommand.class);
+ commands.put(PutDataMapCommand.ERASE_METHOD_ID, PutDataMapCommand.class);
+ commands.put(PutDataMapCommand.METHOD_ID, PutDataMapCommand.class);
+ commands.put(PutDataMapCommand.ERASE_VERSIONED_METHOD_ID, PutDataMapCommand.class);
+ commands.put(PutDataMapCommand.VERSIONED_METHOD_ID, PutDataMapCommand.class);
+ commands.put(PutKeyValueCommand.METHOD_ID, PutKeyValueCommand.class);
+ commands.put(PutKeyValueCommand.PUT_FOR_EXT_READ_METHOD_ID, PutKeyValueCommand.class);
+ commands.put(PutKeyValueCommand.PUT_FOR_EXT_READ_VERSIONED_METHOD_ID, PutKeyValueCommand.class);
+ commands.put(PutKeyValueCommand.VERSIONED_METHOD_ID, PutKeyValueCommand.class);
+ commands.put(RemoveDataCommand.METHOD_ID, RemoveDataCommand.class);
+ commands.put(RemoveDataCommand.VERSIONED_METHOD_ID, RemoveDataCommand.class);
+ commands.put(RemoveKeyCommand.METHOD_ID, RemoveKeyCommand.class);
+ commands.put(RemoveKeyCommand.VERSIONED_METHOD_ID, RemoveKeyCommand.class);
+ commands.put(RemoveNodeCommand.METHOD_ID, RemoveNodeCommand.class);
+ commands.put(RemoveNodeCommand.VERSIONED_METHOD_ID, RemoveNodeCommand.class);
+ commands.put(BlockChannelCommand.METHOD_ID, BlockChannelCommand.class);
+ commands.put(UnblockChannelCommand.METHOD_ID, UnblockChannelCommand.class);
+ commands.put(AnnounceBuddyPoolNameCommand.METHOD_ID, AnnounceBuddyPoolNameCommand.class);
+ commands.put(AssignToBuddyGroupCommand.METHOD_ID, AssignToBuddyGroupCommand.class);
+ commands.put(ClusteredGetCommand.METHOD_ID, ClusteredGetCommand.class);
+ commands.put(DataGravitationCleanupCommand.METHOD_ID, DataGravitationCleanupCommand.class);
+ commands.put(RemoveFromBuddyGroupCommand.METHOD_ID, RemoveFromBuddyGroupCommand.class);
+ commands.put(ReplicateCommand.SINGLE_METHOD_ID, ReplicateCommand.class);
+ commands.put(ReplicateCommand.MULTIPLE_METHOD_ID, ReplicateCommand.class);
+ commands.put(CommitCommand.METHOD_ID, CommitCommand.class);
+ commands.put(OptimisticPrepareCommand.METHOD_ID, OptimisticPrepareCommand.class);
+ commands.put(PrepareCommand.METHOD_ID, PrepareCommand.class);
+ commands.put(RollbackCommand.METHOD_ID, RollbackCommand.class);
+ commands.put(EvictNodeCommand.METHOD_ID, EvictNodeCommand.class);
+ commands.put(EvictNodeCommand.VERSIONED_METHOD_ID, EvictNodeCommand.class);
+ commands.put(GravitateDataCommand.METHOD_ID, GravitateDataCommand.class);
+ commands.put(InvalidateCommand.METHOD_ID, InvalidateCommand.class);
+ }
+
+ public void testUnusedMethodIds()
+ {
+ // ensure that the unused method ids aren't used by any of the Commands.
+ for (Integer i : unusedIds)
+ {
+ assert !commands.containsKey(i) : "Id [" + i + "] is used by Command " + commands.get(i).getName();
+ assert !fieldMap.containsKey(i) : "Id [" + i + "] is used by MethodDeclarations class in field " + fieldMap.get(i).getName();
+ }
+ }
+
+ public void testMethodCalls() throws Exception
+ {
+ assert 47 == fieldMap.lastKey();
+ assert 47 == commands.lastKey() : "Expected commands last key to be 47; was " + commands.lastKey();
+ printMaps();
+ assert commands.size() == fieldMap.size() : "Was expecting commands and fieldMap sizes to be the same. FieldMap size is " + fieldMap.size() + " and commands size is " + commands.size();
+ }
+
+ private void printMaps()
+ {
+ for (int i = 0; i < fieldMap.lastKey(); i++)
+ {
+ boolean unused = unusedIds.contains(i);
+ System.out.print("ID: " + i);
+ if (unused)
+ {
+ System.out.println(" *** UNUSED");
+ }
+ else
+ {
+ System.out.println(" Field: " + fieldMap.get(i).getName() + " Command: " + commands.get(i));
+ }
+ }
+ }
+}
16 years, 2 months
JBoss Cache SVN: r5550 - core/trunk.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-04-14 10:41:30 -0400 (Mon, 14 Apr 2008)
New Revision: 5550
Modified:
core/trunk/README-Maven.txt
Log:
Added a group for manual tests
Modified: core/trunk/README-Maven.txt
===================================================================
--- core/trunk/README-Maven.txt 2008-04-14 14:11:28 UTC (rev 5549)
+++ core/trunk/README-Maven.txt 2008-04-14 14:41:30 UTC (rev 5550)
@@ -116,6 +116,7 @@
* jgroups - Tests which need to send data on a JGroups Channel
* transaction - Tests which use a transaction manager
* profiling - Tests used for manual profiling, not meant for automated test runs
+* manual - Other tests that are run manually
* integration - Integration tests emulating usage patterns for specific products such as JBoss AS Clustering and Hibernate clustering
It should be noted that every test (except those not intended to be run by Hudson) should at least be in the functional
16 years, 2 months
JBoss Cache SVN: r5549 - in core/trunk/src/test/java/org/jboss/cache: misc and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-04-14 10:11:28 -0400 (Mon, 14 Apr 2008)
New Revision: 5549
Modified:
core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java
Log:
JBCACHE-1222 - fixed eviction tests
Modified: core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java 2008-04-14 13:22:50 UTC (rev 5548)
+++ core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java 2008-04-14 14:11:28 UTC (rev 5549)
@@ -80,6 +80,7 @@
cache.start();
invoker = TestingUtil.extractComponentRegistry(cache).getComponent(InterceptorChain.class);
+ commandsFactory = TestingUtil.extractCommandsFactory(cache);
regionManager = cache.getRegionManager();
}
@@ -324,7 +325,7 @@
for (int i = 0; i < 100; i++)
{
- PutKeyValueCommand pkvCommand = commandsFactory.buildPutKeyValueCommand(null, (Fqn<?>) fqn, data, false, false, false);
+ PutKeyValueCommand pkvCommand = commandsFactory.buildPutKeyValueCommand(null, (Fqn<?>) fqn, i, "value", false, false);
invoker.invoke(pkvCommand);
assertEquals("value", cache.peek(fqn, false, false).getDirect(i));
@@ -417,7 +418,7 @@
putQuietly(fqn, "a", "b");
putQuietly(fqn, "b", "c");
- RemoveDataCommand removeDataCommand = new RemoveDataCommand(null, fqn, false, false, false);
+ RemoveDataCommand removeDataCommand = commandsFactory.buildRemoveDataCommand(null, fqn, false, false, false);
invoker.invoke(removeDataCommand);
assertEquals(0, cache.peek(fqn, false, false).getDataDirect().size());
@@ -500,7 +501,7 @@
assertEquals(fqn, event.getFqn());
assertNull(region.takeLastEventNode());
- RemoveNodeCommand removeNodeCommand = new RemoveNodeCommand(null, fqn, false, false, false);
+ RemoveNodeCommand removeNodeCommand = commandsFactory.buildRemoveNodeCommand(null, fqn, false, false, false);
invoker.invoke(removeNodeCommand);
assertNull(cache.getNode(fqn));
event = region.takeLastEventNode();
Modified: core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java 2008-04-14 13:22:50 UTC (rev 5548)
+++ core/trunk/src/test/java/org/jboss/cache/misc/TestingUtil.java 2008-04-14 14:11:28 UTC (rev 5549)
@@ -12,11 +12,13 @@
import org.jboss.cache.CacheStatus;
import org.jboss.cache.Fqn;
import org.jboss.cache.commands.CacheCommand;
+import org.jboss.cache.commands.CommandsFactory;
import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.interceptors.Interceptor;
import org.jboss.cache.interceptors.base.ChainedInterceptor;
import org.jboss.cache.invocation.CacheInvocationDelegate;
import org.jboss.cache.invocation.InterceptorChain;
+import org.jboss.cache.invocation.CacheLifecycleManager;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.CacheLoaderManager;
@@ -470,8 +472,8 @@
*/
public static ComponentRegistry extractComponentRegistry(Cache cache)
{
- InterceptorChain ic = (InterceptorChain) extractField(cache, "invoker");
- return extractComponentRegistry(ic);
+ CacheLifecycleManager clm = (CacheLifecycleManager) extractField(cache, "lifecycleManager");
+ return (ComponentRegistry) extractField(clm, "componentRegistry");
}
/**
@@ -545,4 +547,8 @@
}
+ public static CommandsFactory extractCommandsFactory(CacheSPI<Object, Object> cache)
+ {
+ return (CommandsFactory) extractField(cache, "commandsFactory");
+ }
}
16 years, 2 months
JBoss Cache SVN: r5548 - in core/trunk/src: main/java/org/jboss/cache/buddyreplication and 18 other directories.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-04-14 09:22:50 -0400 (Mon, 14 Apr 2008)
New Revision: 5548
Added:
core/trunk/src/main/java/org/jboss/cache/commands/BaseCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/CommandsVisitor.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/EvictFqnCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/InvalidateCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/functional/
core/trunk/src/main/java/org/jboss/cache/commands/functional/MarshallableCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/functional/TxCacheCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/GravitateDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/state/
core/trunk/src/main/java/org/jboss/cache/commands/state/DataVersionCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/state/GlobalTransactionCommand.java
Removed:
core/trunk/src/main/java/org/jboss/cache/commands/BaseCacheCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/CacheCommandsVisitor.java
core/trunk/src/main/java/org/jboss/cache/commands/DataVersionCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/EvictFqnCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/GlobalTransactionCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/GravitateDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/InvalidateCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/MarshallableCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/TxCacheCommand.java
Modified:
core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java
core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
core/trunk/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java
core/trunk/src/main/java/org/jboss/cache/commands/CacheCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/CacheDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/ExistsNodeCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetChildrenNamesCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetDataMapCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeyValueCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeysCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetNodeCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/MoveCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveKeyCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/channel/BlockChannelCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/channel/UnblockChannelCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/tx/CommitCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/tx/RollbackCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/visitors/AbstractCommandsVisitor.java
core/trunk/src/main/java/org/jboss/cache/commands/visitors/DataVersionCommandsVisitor.java
core/trunk/src/main/java/org/jboss/cache/commands/visitors/GlobalTransactionCommandsVisitor.java
core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
core/trunk/src/main/java/org/jboss/cache/marshall/MethodCallWrapper.java
core/trunk/src/main/java/org/jboss/cache/transaction/TransactionEntry.java
core/trunk/src/main/java/org/jboss/cache/transaction/TransactionTable.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java
Log:
JBCACHE-1222 - package redistribution
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -9,7 +9,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.MarshallableCommand;
+import org.jboss.cache.commands.functional.MarshallableCommand;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.RuntimeConfig;
import org.jboss.cache.factories.annotations.Inject;
Modified: core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -5,17 +5,12 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.CacheCommand;
import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.EvictFqnCommand;
-import org.jboss.cache.commands.GravitateDataCommand;
-import org.jboss.cache.commands.InvalidateCommand;
-import org.jboss.cache.commands.MarshallableCommand;
+import org.jboss.cache.commands.cachedata.EvictFqnCommand;
+import org.jboss.cache.commands.remote.GravitateDataCommand;
+import org.jboss.cache.commands.cachedata.InvalidateCommand;
+import org.jboss.cache.commands.functional.MarshallableCommand;
import org.jboss.cache.commands.cachedata.*;
-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.remote.*;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
Modified: core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -17,7 +17,7 @@
import org.jboss.cache.RegionManager;
import org.jboss.cache.commands.CacheCommand;
import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.MarshallableCommand;
+import org.jboss.cache.commands.functional.MarshallableCommand;
import org.jboss.cache.commands.remote.AnnounceBuddyPoolNameCommand;
import org.jboss.cache.commands.remote.AssignToBuddyGroupCommand;
import org.jboss.cache.commands.remote.RemoveFromBuddyGroupCommand;
Modified: core/trunk/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -4,7 +4,7 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.RPCManager;
import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.MarshallableCommand;
+import org.jboss.cache.commands.functional.MarshallableCommand;
import org.jboss.cache.commands.remote.ReplicateCommand;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.annotations.Inject;
Deleted: core/trunk/src/main/java/org/jboss/cache/commands/BaseCacheCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/BaseCacheCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/BaseCacheCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -1,51 +0,0 @@
-package org.jboss.cache.commands;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.CacheInjectionMethods;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
-import org.jboss.cache.notifications.Notifier;
-
-/**
- * @author Mircea.Markus(a)jboss.com
- * @since 2.2
- */
-@CacheInjectionMethods
-public abstract class BaseCacheCommand implements MarshallableCommand
-{
- protected static final Object[] EMPTY_OBJECT_ARRAY = new Object[]{};
- protected Log log = LogFactory.getLog(getClass());
- protected Notifier notifier;
- protected CacheData cacheData;
- protected CacheSPI spi;
- protected Configuration configuration;
- protected static boolean trace;
-
- @Inject
- public void init(Notifier notifier, CacheData cacheData, CacheSPI spi, Configuration configuration)
- {
- this.notifier = notifier;
- this.cacheData = cacheData;
- this.spi = spi;
- this.configuration = configuration;
- trace = log.isTraceEnabled();
- }
-
- public Notifier getNotifier()
- {
- return notifier;
- }
-
- public CacheData getCacheData()
- {
- return cacheData;
- }
-
- public CacheSPI getSpi()
- {
- return spi;
- }
-}
Copied: core/trunk/src/main/java/org/jboss/cache/commands/BaseCommand.java (from rev 5546, core/trunk/src/main/java/org/jboss/cache/commands/BaseCacheCommand.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/BaseCommand.java (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/commands/BaseCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -0,0 +1,52 @@
+package org.jboss.cache.commands;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.commands.functional.MarshallableCommand;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.factories.annotations.CacheInjectionMethods;
+import org.jboss.cache.invocation.CacheData;
+import org.jboss.cache.notifications.Notifier;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ * @since 2.2
+ */
+@CacheInjectionMethods
+public abstract class BaseCommand implements MarshallableCommand
+{
+ protected static final Object[] EMPTY_OBJECT_ARRAY = new Object[]{};
+ protected Log log = LogFactory.getLog(getClass());
+ protected Notifier notifier;
+ protected CacheData cacheData;
+ protected CacheSPI spi;
+ protected Configuration configuration;
+ protected static boolean trace;
+
+ @Inject
+ public void init(Notifier notifier, CacheData cacheData, CacheSPI spi, Configuration configuration)
+ {
+ this.notifier = notifier;
+ this.cacheData = cacheData;
+ this.spi = spi;
+ this.configuration = configuration;
+ trace = log.isTraceEnabled();
+ }
+
+ public Notifier getNotifier()
+ {
+ return notifier;
+ }
+
+ public CacheData getCacheData()
+ {
+ return cacheData;
+ }
+
+ public CacheSPI getSpi()
+ {
+ return spi;
+ }
+}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/CacheCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/CacheCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/CacheCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -11,5 +11,5 @@
{
Object perform(InvocationContext ctx) throws Throwable;
- Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable;
+ Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable;
}
Deleted: core/trunk/src/main/java/org/jboss/cache/commands/CacheCommandsVisitor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/CacheCommandsVisitor.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/CacheCommandsVisitor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -1,204 +0,0 @@
-package org.jboss.cache.commands;
-
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.cachedata.*;
-import org.jboss.cache.commands.tx.PrepareCommand;
-import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
-import org.jboss.cache.commands.remote.*;
-import org.jboss.cache.commands.channel.BlockChannelCommand;
-import org.jboss.cache.commands.channel.UnblockChannelCommand;
-
-/**
- * @author Mircea.Markus(a)jboss.com
- * @since 2.2
- */
-public interface CacheCommandsVisitor
-{
-
-// put methods:
-// putMethodIds.add(putDataMethodLocal_id);
-// putMethodIds.add(putDataEraseMethodLocal_id);
-// putMethodIds.add(putKeyValMethodLocal_id);
-// putMethodIds.add(putDataEraseVersionedMethodLocal_id);
-// putMethodIds.add(putDataVersionedMethodLocal_id);
-// putMethodIds.add(putKeyValVersionedMethodLocal_id);
-// putMethodIds.add(putForExternalReadMethodLocal_id);
-// putMethodIds.add(putForExternalReadVersionedMethodLocal_id);
-// crudMethods
-// crudMethodIds.addAll(putMethodIds);
-// crudMethodIds.add(removeNodeMethodLocal_id);
-// crudMethodIds.add(removeKeyMethodLocal_id);
-// crudMethodIds.add(removeDataMethodLocal_id);
-// crudMethodIds.add(dataGravitationCleanupMethod_id);
-// crudMethodIds.add(moveMethodLocal_id);
-// crudMethodIds.add(removeNodeVersionedMethodLocal_id);
-// crudMethodIds.add(removeKeyVersionedMethodLocal_id);
-// crudMethodIds.add(removeDataVersionedMethodLocal_id);
-
-
- /*
- equiv of old:
- 1 - putDataEraseMethodLocal_id
- 2 - putDataMethodLocal_id
- 3 - putDataEraseVersionedMethodLocal_id
- 4 - putDataVersionedMethodLocal_id
- */
- public Object handlePutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable;
-
- /*
- equiv of old:
- 1 - putKeyValMethodLocal_id
- 2 - putKeyValVersionedMethodLocal_id
- 3 - putForExternalReadMethodLocal_id
- 4 - putForExternalReadVersionedMethodLocal_id
- */
- public Object handlePutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand putKeyValueCommand) throws Throwable;
-
- /*
- equiv of old:
- 1 - removeNodeMethodLocal_id
- 2 - removeNodeVersionedMethodLocal_id
- */
- public Object handleRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand removeNodeCommand) throws Throwable;
-
- /*
- equiv of old:
- 1 - removeDataMethodLocal_id
- 2 - removeDataVersionedMethodLocal_id
- */
- public Object handleRemoveDataCommand(InvocationContext ctx, RemoveDataCommand removeDataCommand) throws Throwable;
-
- /*
- equiv of old:
- 1 - evictNodeMethodLocal_id
- 2 - evictVersionedNodeMethodLocal_id
- */
- public Object handleEvictFqnCommand(InvocationContext ctx, EvictFqnCommand evictFqnCommand) throws Throwable;
-
- /*
- equiv of old:
- 1 - invalidateMethodLocal_id
- */
- public Object handleInvalidateCommand(InvocationContext ctx, InvalidateCommand invalidateCommand) throws Throwable;
-
- /*
- equiv of old:
- 1 - removeKeyMethodLocal_id
- 1 - removeKeyVersionedMethodLocal_id
- */
- public Object handleRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand removeKeyCommand) throws Throwable;
-
- /*
- equiv of old:
- 1 - getDataMapMethodLocal_id
- */
- public Object handleGetDataMapCommand(InvocationContext ctx, GetDataMapCommand getDataMapCommand) throws Throwable;
-
- /*
- equiv of old:
- 1 - existsMethod_id
- */
- public Object handleExistsNodeCommand(InvocationContext ctx, ExistsNodeCommand existsNodeCommand) throws Throwable;
-
- /*
- equiv of old:
- 1 - getKeyValueMethodLocal_id
- */
- public Object handleGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand getKeyValueCommand) throws Throwable;
-
- /*
- equiv of old:
- 1 - getNodeMethodLocal_id
- */
- public Object handleGetNodeCommand(InvocationContext ctx, GetNodeCommand getNodeCommand) throws Throwable;
-
- /*
- equiv of old:
- 1 - getKeysMethodLocal_id
- */
- public Object handleGetKeysCommand(InvocationContext ctx, GetKeysCommand getKeysCommand) throws Throwable;
-
- /*
- equiv of old:
- 1 - getChildrenNamesMethodLocal_id
- */
- public Object handleGetChildrenNamesCommand(InvocationContext ctx, GetChildrenNamesCommand getChildrenNamesCacheCommand) throws Throwable;
-
- /*
- equiv of old:
- 1 - moveMethodLocal_id
- */
- public Object handleMoveCommand(InvocationContext ctx, MoveCommand moveCommand) throws Throwable;
-
- /*
- equiv of old:
- 1 - dataGravitationMethod_id
- */
- public Object handleGravitateDataCommand(InvocationContext ctx, GravitateDataCommand gravitateDataCommand) throws Throwable;
-
- /*
- prepareMethod_id
- */
- public Object handlePrepareCommand(InvocationContext ctx, PrepareCommand prepareCommand) throws Throwable;
-
- /*
- rollbackMethod_id
- */
- public Object handleRollbackCommand(InvocationContext ctx, RollbackCommand rollbackCommand) throws Throwable;
-
- /*
- commitMethod_id
- */
- public Object handleCommitCommand(InvocationContext ctx, CommitCommand commitCommand) throws Throwable;
-
- /*
- optimisticPrepareMethod_id
- */
- public Object handleOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand optimisticPrepareCommand) throws Throwable;
-
- /*
- equiv of old:
- 1 - replicateMethod_id
- 2 - replicateAllMethod_id
- */
- public Object handleReplicateCommand(InvocationContext ctx, ReplicateCommand replicateSingleCommand) throws Throwable;
-
- /*
- equiv of old:
- 1 - remoteAnnounceBuddyPoolNameMethod_id
- */
- public Object handleAnnounceBuddyPoolName(InvocationContext ctx, AnnounceBuddyPoolNameCommand announceBuddyPoolNameCommand) throws Throwable;
-
- /*
- equiv of old:
- 1 - remoteRemoveFromBuddyGroupMethod_id
- */
- public Object handleRemoveFromBuddyGroupCommand(InvocationContext ctx, RemoveFromBuddyGroupCommand removeFromBuddyGroupCommand) throws Throwable;
-
- /*
- 1 - remoteAssignToBuddyGroupMethod_id
- */
- public Object handleAssignToBuddyGroupCommand(InvocationContext ctx, AssignToBuddyGroupCommand assignToBuddyGroupCommand) throws Throwable;
-
- /*
- 1 - dataGravitationCleanupMethod_id
- */
- public Object handleDataGravitationCleanupCommand(InvocationContext ctx, DataGravitationCleanupCommand dataGravitationCleanupCommand) throws Throwable;
-
- /*
- 1 - clusteredGetMethod_id
- */
- public Object handleClusteredGetCommand(InvocationContext ctx, ClusteredGetCommand clusteredGetCommand) throws Throwable;
-
- /*
- blockChannelMethodLocal_id
- */
- public Object handleBlockChannelCommand(InvocationContext ctx, BlockChannelCommand blockChannelCommand) throws Throwable;
-
- /*
- unblockChannelMethodLocal_id
- */
- public Object handleUnblockChannelCommand(InvocationContext ctx, UnblockChannelCommand unblockChannelCommand) throws Throwable;
-}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -7,16 +7,12 @@
import org.jboss.cache.commands.cachedata.*;
import org.jboss.cache.commands.channel.BlockChannelCommand;
import org.jboss.cache.commands.channel.UnblockChannelCommand;
-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.remote.*;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
+import org.jboss.cache.commands.functional.MarshallableCommand;
import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.transaction.GlobalTransaction;
Copied: core/trunk/src/main/java/org/jboss/cache/commands/CommandsVisitor.java (from rev 5546, core/trunk/src/main/java/org/jboss/cache/commands/CacheCommandsVisitor.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/CommandsVisitor.java (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/commands/CommandsVisitor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -0,0 +1,204 @@
+package org.jboss.cache.commands;
+
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.commands.cachedata.*;
+import org.jboss.cache.commands.tx.PrepareCommand;
+import org.jboss.cache.commands.tx.RollbackCommand;
+import org.jboss.cache.commands.tx.CommitCommand;
+import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
+import org.jboss.cache.commands.remote.*;
+import org.jboss.cache.commands.channel.BlockChannelCommand;
+import org.jboss.cache.commands.channel.UnblockChannelCommand;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ * @since 2.2
+ */
+public interface CommandsVisitor
+{
+
+// put methods:
+// putMethodIds.add(putDataMethodLocal_id);
+// putMethodIds.add(putDataEraseMethodLocal_id);
+// putMethodIds.add(putKeyValMethodLocal_id);
+// putMethodIds.add(putDataEraseVersionedMethodLocal_id);
+// putMethodIds.add(putDataVersionedMethodLocal_id);
+// putMethodIds.add(putKeyValVersionedMethodLocal_id);
+// putMethodIds.add(putForExternalReadMethodLocal_id);
+// putMethodIds.add(putForExternalReadVersionedMethodLocal_id);
+// crudMethods
+// crudMethodIds.addAll(putMethodIds);
+// crudMethodIds.add(removeNodeMethodLocal_id);
+// crudMethodIds.add(removeKeyMethodLocal_id);
+// crudMethodIds.add(removeDataMethodLocal_id);
+// crudMethodIds.add(dataGravitationCleanupMethod_id);
+// crudMethodIds.add(moveMethodLocal_id);
+// crudMethodIds.add(removeNodeVersionedMethodLocal_id);
+// crudMethodIds.add(removeKeyVersionedMethodLocal_id);
+// crudMethodIds.add(removeDataVersionedMethodLocal_id);
+
+
+ /*
+ equiv of old:
+ 1 - putDataEraseMethodLocal_id
+ 2 - putDataMethodLocal_id
+ 3 - putDataEraseVersionedMethodLocal_id
+ 4 - putDataVersionedMethodLocal_id
+ */
+ public Object handlePutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable;
+
+ /*
+ equiv of old:
+ 1 - putKeyValMethodLocal_id
+ 2 - putKeyValVersionedMethodLocal_id
+ 3 - putForExternalReadMethodLocal_id
+ 4 - putForExternalReadVersionedMethodLocal_id
+ */
+ public Object handlePutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand putKeyValueCommand) throws Throwable;
+
+ /*
+ equiv of old:
+ 1 - removeNodeMethodLocal_id
+ 2 - removeNodeVersionedMethodLocal_id
+ */
+ public Object handleRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand removeNodeCommand) throws Throwable;
+
+ /*
+ equiv of old:
+ 1 - removeDataMethodLocal_id
+ 2 - removeDataVersionedMethodLocal_id
+ */
+ public Object handleRemoveDataCommand(InvocationContext ctx, RemoveDataCommand removeDataCommand) throws Throwable;
+
+ /*
+ equiv of old:
+ 1 - evictNodeMethodLocal_id
+ 2 - evictVersionedNodeMethodLocal_id
+ */
+ public Object handleEvictFqnCommand(InvocationContext ctx, EvictFqnCommand evictFqnCommand) throws Throwable;
+
+ /*
+ equiv of old:
+ 1 - invalidateMethodLocal_id
+ */
+ public Object handleInvalidateCommand(InvocationContext ctx, InvalidateCommand invalidateCommand) throws Throwable;
+
+ /*
+ equiv of old:
+ 1 - removeKeyMethodLocal_id
+ 1 - removeKeyVersionedMethodLocal_id
+ */
+ public Object handleRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand removeKeyCommand) throws Throwable;
+
+ /*
+ equiv of old:
+ 1 - getDataMapMethodLocal_id
+ */
+ public Object handleGetDataMapCommand(InvocationContext ctx, GetDataMapCommand getDataMapCommand) throws Throwable;
+
+ /*
+ equiv of old:
+ 1 - existsMethod_id
+ */
+ public Object handleExistsNodeCommand(InvocationContext ctx, ExistsNodeCommand existsNodeCommand) throws Throwable;
+
+ /*
+ equiv of old:
+ 1 - getKeyValueMethodLocal_id
+ */
+ public Object handleGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand getKeyValueCommand) throws Throwable;
+
+ /*
+ equiv of old:
+ 1 - getNodeMethodLocal_id
+ */
+ public Object handleGetNodeCommand(InvocationContext ctx, GetNodeCommand getNodeCommand) throws Throwable;
+
+ /*
+ equiv of old:
+ 1 - getKeysMethodLocal_id
+ */
+ public Object handleGetKeysCommand(InvocationContext ctx, GetKeysCommand getKeysCommand) throws Throwable;
+
+ /*
+ equiv of old:
+ 1 - getChildrenNamesMethodLocal_id
+ */
+ public Object handleGetChildrenNamesCommand(InvocationContext ctx, GetChildrenNamesCommand getChildrenNamesCacheCommand) throws Throwable;
+
+ /*
+ equiv of old:
+ 1 - moveMethodLocal_id
+ */
+ public Object handleMoveCommand(InvocationContext ctx, MoveCommand moveCommand) throws Throwable;
+
+ /*
+ equiv of old:
+ 1 - dataGravitationMethod_id
+ */
+ public Object handleGravitateDataCommand(InvocationContext ctx, GravitateDataCommand gravitateDataCommand) throws Throwable;
+
+ /*
+ prepareMethod_id
+ */
+ public Object handlePrepareCommand(InvocationContext ctx, PrepareCommand prepareCommand) throws Throwable;
+
+ /*
+ rollbackMethod_id
+ */
+ public Object handleRollbackCommand(InvocationContext ctx, RollbackCommand rollbackCommand) throws Throwable;
+
+ /*
+ commitMethod_id
+ */
+ public Object handleCommitCommand(InvocationContext ctx, CommitCommand commitCommand) throws Throwable;
+
+ /*
+ optimisticPrepareMethod_id
+ */
+ public Object handleOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand optimisticPrepareCommand) throws Throwable;
+
+ /*
+ equiv of old:
+ 1 - replicateMethod_id
+ 2 - replicateAllMethod_id
+ */
+ public Object handleReplicateCommand(InvocationContext ctx, ReplicateCommand replicateSingleCommand) throws Throwable;
+
+ /*
+ equiv of old:
+ 1 - remoteAnnounceBuddyPoolNameMethod_id
+ */
+ public Object handleAnnounceBuddyPoolName(InvocationContext ctx, AnnounceBuddyPoolNameCommand announceBuddyPoolNameCommand) throws Throwable;
+
+ /*
+ equiv of old:
+ 1 - remoteRemoveFromBuddyGroupMethod_id
+ */
+ public Object handleRemoveFromBuddyGroupCommand(InvocationContext ctx, RemoveFromBuddyGroupCommand removeFromBuddyGroupCommand) throws Throwable;
+
+ /*
+ 1 - remoteAssignToBuddyGroupMethod_id
+ */
+ public Object handleAssignToBuddyGroupCommand(InvocationContext ctx, AssignToBuddyGroupCommand assignToBuddyGroupCommand) throws Throwable;
+
+ /*
+ 1 - dataGravitationCleanupMethod_id
+ */
+ public Object handleDataGravitationCleanupCommand(InvocationContext ctx, DataGravitationCleanupCommand dataGravitationCleanupCommand) throws Throwable;
+
+ /*
+ 1 - clusteredGetMethod_id
+ */
+ public Object handleClusteredGetCommand(InvocationContext ctx, ClusteredGetCommand clusteredGetCommand) throws Throwable;
+
+ /*
+ blockChannelMethodLocal_id
+ */
+ public Object handleBlockChannelCommand(InvocationContext ctx, BlockChannelCommand blockChannelCommand) throws Throwable;
+
+ /*
+ unblockChannelMethodLocal_id
+ */
+ public Object handleUnblockChannelCommand(InvocationContext ctx, UnblockChannelCommand unblockChannelCommand) throws Throwable;
+}
Deleted: core/trunk/src/main/java/org/jboss/cache/commands/DataVersionCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/DataVersionCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/DataVersionCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -1,22 +0,0 @@
-package org.jboss.cache.commands;
-
-import org.jboss.cache.optimistic.DataVersion;
-
-/**
- * Commands that know how to deal with versioned data.
- *
- * @author Mircea.Markus(a)jboss.com
- * @since 2.2
- */
-public interface DataVersionCommand extends CacheCommand
-{
- public DataVersion getDataVersion();
-
- public void setDataVersion(DataVersion dataVersion);
-
- /**
- * Has data version set? (i.e. not null)
- * // todo: should this be an abstract class rather than an interface? isVersioned() is implemented exactly the same way in all subclasses.
- */
- public boolean isVersioned();
-}
Deleted: core/trunk/src/main/java/org/jboss/cache/commands/EvictFqnCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/EvictFqnCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/EvictFqnCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -1,86 +0,0 @@
-package org.jboss.cache.commands;
-
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
-import org.jboss.cache.optimistic.DataVersion;
-
-/**
- * Implements functionality defined by {@link org.jboss.cache.CacheSPI#evict(org.jboss.cache.Fqn)}
- *
- * @author Mircea.Markus(a)jboss.com
- * @since 2.2
- */
-public class EvictFqnCommand extends BaseCacheCommand implements DataVersionCommand
-{
- public static final int METHOD_ID = 8;
- public static final int VERSIONED_METHOD_ID = 9;
-
- /* dependencies*/
- protected CacheData cacheData;
-
- /* parameters*/
- protected Fqn fqn;
- protected DataVersion dataVersion;
-
- public EvictFqnCommand(Fqn fqn)
- {
- this.fqn = fqn;
- }
-
- @Inject
- public void initialize(CacheData cacheData)
- {
- this.cacheData = cacheData;
- }
-
- public Object perform(InvocationContext ctx)
- {
- return cacheData.evict(fqn);
- }
-
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
- {
- return handler.handleEvictFqnCommand(ctx, this);
- }
-
- public int getCommandId()
- {
- return isVersioned() ? VERSIONED_METHOD_ID : METHOD_ID;
- }
-
- public Fqn getFqn()
- {
- return fqn;
- }
-
- public DataVersion getDataVersion()
- {
- return dataVersion;
- }
-
- public void setDataVersion(DataVersion dataVersion)
- {
- this.dataVersion = dataVersion;
- }
-
- public boolean isVersioned()
- {
- return dataVersion != null;
- }
-
- public Object[] getParameters()
- {
- if (isVersioned())
- return new Object[]{fqn, dataVersion};
- else
- return new Object[]{fqn};
- }
-
- public void setState(int commandId, Object[] args)
- {
- fqn = (Fqn) args[0];
- if (commandId == VERSIONED_METHOD_ID) dataVersion = (DataVersion) args[1];
- }
-}
Deleted: core/trunk/src/main/java/org/jboss/cache/commands/GlobalTransactionCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/GlobalTransactionCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/GlobalTransactionCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -1,14 +0,0 @@
-package org.jboss.cache.commands;
-
-import org.jboss.cache.transaction.GlobalTransaction;
-
-/**
- * @author Mircea.Markus(a)jboss.com
- * @since 2.2
- */
-public interface GlobalTransactionCommand extends CacheCommand
-{
- public GlobalTransaction getGlobalTransaction();
-
- void setGlobalTransaction(GlobalTransaction gtx);
-}
Deleted: core/trunk/src/main/java/org/jboss/cache/commands/GravitateDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/GravitateDataCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/GravitateDataCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -1,188 +0,0 @@
-package org.jboss.cache.commands;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.Node;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.RPCManager;
-import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
-import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.buddyreplication.GravitateResult;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
-import org.jboss.cache.marshall.NodeData;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
-/**
- * Used with buddy replication's data gravitation interceptor. If marshalling is necessary, ensure that the cache is
- * configured to use {@link org.jboss.cache.config.Configuration#useRegionBasedMarshalling} and the {@link org.jboss.cache.Region}
- * pertaining to the Fqn passed in is activated, and has an appropriate ClassLoader.
- * todo - this should not be a command as none relally visits it. It was inherited this way from old CacheImpl
- */
-public class GravitateDataCommand extends BaseCacheCommand implements CacheCommand
-{
- public static final int METHOD_ID = 35;
- private static final Log log = LogFactory.getLog(GravitateDataCommand.class);
-
- /* dependencies */
- private CacheSPI spi; //todo ugly dependency, revisit
- private RPCManager rpcManager;
- private CacheData cacheData;
-
- /* parametres */
- private Fqn fqn;
- private boolean searchSubtrees;
-
- public GravitateDataCommand(Fqn fqn, boolean searchSubtrees)
- {
- this.fqn = fqn;
- this.searchSubtrees = searchSubtrees;
- }
-
- @Inject
- public void initialize(CacheSPI spi, RPCManager manager, CacheData cacheData)
- {
- this.spi = spi;
- this.rpcManager = manager;
- this.cacheData = cacheData;
- }
-
- public Object perform(InvocationContext ctx)
- {
- // for now, perform a very simple series of getData calls.
- if (log.isTraceEnabled()) log.trace("Caller is asking for " + fqn);
- try
- {
- ctx.setOriginLocal(false);
- // use a get() call into the cache to make sure cache loading takes place.
- // no need to cache the original skipDataGravitation setting here - it will always be false of we got here!!
- ctx.getOptionOverrides().setSkipDataGravitation(true);
- Node actualNode = spi.getNode(fqn);
- ctx.getOptionOverrides().setSkipDataGravitation(false);
-
- if (log.isTraceEnabled()) log.trace("In local tree, this is " + actualNode);
-
- Fqn backupNodeFqn = null;
- if (actualNode == null && searchSubtrees)
- {
- log.trace("Looking at backup trees.");
- NodeSPI backupSubtree = cacheData.findNode(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN);
- if (backupSubtree != null)
- {
- // need to loop through backupSubtree's children
- Set childNames = backupSubtree.getChildrenNamesDirect();
- if (childNames != null)
- {
- for (Object childName : childNames)
- {
- // childName is the name of a buddy group since all child names in this
- // collection are direct children of BUDDY_BACKUP_SUBTREE_FQN
- Fqn backupRoot = Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, childName);
- if (BuddyManager.isDeadBackupRoot(backupRoot))
- {
- //actualNode = searchDeadRoot(backupRoot, fqn);
- Set<Integer> deadChildNames = new TreeSet<Integer>(spi.getChildrenNames(backupRoot));
- Integer[] elems = deadChildNames.toArray(new Integer[]{});
-
- // these are integers. we need to start with the highest/most recent.
- for (int i = elems.length - 1; i > -1; i--)
- {
- Integer versionOfDefunctData = elems[i];
- backupNodeFqn = Fqn.fromRelativeFqn(Fqn.fromRelativeElements(backupRoot, versionOfDefunctData), fqn);
-
- // use a get() call into the cache to make sure cache loading takes place.
- ctx.getOptionOverrides().setSkipDataGravitation(true);
- actualNode = spi.peek(backupNodeFqn, false);
- ctx.getOptionOverrides().setSkipDataGravitation(false);
-
- // break out of the inner loop searching through the dead node's various backups
- if (actualNode != null) break;
- }
- }
- else
- {
- backupNodeFqn = Fqn.fromRelativeFqn(backupRoot, fqn);
- // use a get() call into the cache to make sure cache loading takes place.
- ctx.getOptionOverrides().setSkipDataGravitation(true);
- actualNode = spi.getNode(backupNodeFqn);
- ctx.getOptionOverrides().setSkipDataGravitation(false);
- }
-
- if (log.isTraceEnabled())
- log.trace("Looking for " + backupNodeFqn + ". Search result: " + actualNode);
-
- // break out of outer loop searching through all available backups.
- if (actualNode != null) break;
- }
- }
- }
- }
-
- if (actualNode == null)
- {
- return GravitateResult.noDataFound();
- }
- else
- {
- // make sure we LOAD data for this node!!
- actualNode.getData();
- }
-
- if (backupNodeFqn == null && searchSubtrees)
- {
- backupNodeFqn = BuddyFqnTransformer.getBackupFqn(BuddyManager.getGroupNameFromAddress(rpcManager.getLocalAddress()), fqn);
- }
-
- List<NodeData> list = cacheData.getNodeData(new LinkedList<NodeData>(), (NodeSPI) actualNode);
-
- return GravitateResult.subtreeResult(list, backupNodeFqn);
- }
- catch (RuntimeException re)
- {
- if (log.isTraceEnabled()) log.trace("Caught throwable", re);
- throw re;
- }
- finally
- {
- ctx.setOriginLocal(true);
- }
- }
-
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
- {
- return handler.handleGravitateDataCommand(ctx, this);
- }
-
- public int getCommandId()
- {
- return METHOD_ID;
- }
-
- public Fqn getFqn()
- {
- return fqn;
- }
-
- public boolean isSearchSubtrees()
- {
- return searchSubtrees;
- }
-
- public Object[] getParameters()
- {
- return new Object[]{fqn, searchSubtrees};
- }
-
- public void setState(int commandId, Object[] args)
- {
- fqn = (Fqn) args[0];
- searchSubtrees = (Boolean) args[1];
- }
-}
Deleted: core/trunk/src/main/java/org/jboss/cache/commands/InvalidateCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/InvalidateCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/InvalidateCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -1,158 +0,0 @@
-package org.jboss.cache.commands;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.Node;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.config.Option;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
-import org.jboss.cache.marshall.MethodCall;
-import org.jboss.cache.notifications.Notifier;
-import org.jboss.cache.optimistic.DataVersion;
-
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * Very much like an evict(), except that regardless of whether there is a child present, this call will never
- * remove the node from memory - just remove its contents.
- * <p/>
- * Also, potentially throws a cache exception if data versioning is used and the node in memory has a newer data
- * version than what is passed in.
- * <p/>
- * Finally, the data version of the in-memory node is updated to the version being evicted to prevent versions
- * going out of sync.
- *
- * @author Mircea.Markus(a)jboss.com
- * @since 2.2
- */
-public class InvalidateCommand extends EvictFqnCommand
-{
- private static final Log log = LogFactory.getLog(InvalidateCommand.class);
-
- /* dependencies*/
- private boolean isOptimisticLocking;
- private Notifier notifier;
- private CacheSPI cacheSpi;//todo this is ugly, revisit
- private TransactionManager transactionManager;
-
- public InvalidateCommand(Fqn fqn)
- {
- super(fqn);
- }
-
- @Inject
- public void initialize(CacheData cacheData, Notifier notifier, CacheSPI cacheSPI, TransactionManager txManager, boolean isOptimisticLocking)
- {
- super.initialize(cacheData);
- this.notifier = notifier;
- this.cacheSpi = cacheSPI;
- this.transactionManager = txManager;
- this.isOptimisticLocking = isOptimisticLocking;
- }
-
- public Object perform(InvocationContext ctx)
- {
- Node node = cacheSpi.getNode(fqn); // force interceptor chain, load if necessary from cache loader.
-
- if (node == null)
- {
- // if pessimistic locking, just return.
- if (!isOptimisticLocking) return null;
-
- // check if a tombstone already exists
- NodeSPI nodeSPI = cacheData.peek(fqn, false, true);
- if (nodeSPI == null)
- {
- if (dataVersion == null)
- {
- if (log.isTraceEnabled())
- log.trace("Would have created a tombstone since the node doesn't exist, but the version to invalidate is null and hence cannot create a tombstone!");
- return null;
- }
- if (log.isTraceEnabled())
- log.trace("Node doesn't exist; creating a tombstone with data version " + dataVersion);
- // create the node we need.
- Map m = Collections.emptyMap();
- InvocationContext ic = cacheSpi.getInvocationContext();
- Option o = ic.getOptionOverrides();
- boolean origCacheModeLocal = o.isCacheModeLocal();
- o.setCacheModeLocal(true);
- o.setDataVersion(dataVersion);
- // if we are in a tx this call should happen outside of any tx
- try
- {
- Transaction suspended = null;
- if (transactionManager != null)
- {
- suspended = transactionManager.suspend();
- }
- cacheSpi.put(fqn, m);
- if (suspended != null) transactionManager.resume(suspended);
- ic.getOptionOverrides().setCacheModeLocal(origCacheModeLocal);
- }
- catch (Exception e)
- {
- log.error("Unable to create tombstone!", e);
- }
- nodeSPI = (NodeSPI) cacheData.getRoot().getChild(fqn);
- }
- node = nodeSPI;
- }
-
- if (isOptimisticLocking)
- removeData();
- else
- super.perform(ctx);
-
- // mark the node to be removed (and all children) as invalid so anyone holding a direct reference to it will
- // be aware that it is no longer valid.
- ((NodeSPI) node).setValid(false, true);
-
- if (dataVersion != null)
- {
- NodeSPI n = cacheData.peek(fqn, false, true);
- n.setVersion(dataVersion);
- }
- return null;
- }
-
- public void removeData()
- throws CacheException
- {
- MethodCall undo_op = null;
- // Find the node. This will lock it (if <tt>locking</tt> is true) and
- // add the temporarily created parent nodes to the TX's node list if tx != null)
- NodeSPI n = cacheData.findNode(fqn, dataVersion);
- if (n == null)
- {
- log.warn("node " + fqn + " not found");
- return;
- }
- InvocationContext ctx = cacheSpi.getInvocationContext();
- notifier.notifyNodeEvicted(fqn, true, ctx);
- n.clearDataDirect();
- n.setDataLoaded(false);
-
- // FIXME Bela did this so GUI view can refresh the view after node is evicted. But this breaks eviction policy, especially AOP!!!!
- notifier.notifyNodeEvicted(fqn, false, ctx);
- }
-
-
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
- {
- return handler.handleInvalidateCommand(ctx, this);
- }
-
- public DataVersion getVersionToInvalidate()
- {
- return dataVersion;
- }
-}
Deleted: core/trunk/src/main/java/org/jboss/cache/commands/MarshallableCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/MarshallableCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/MarshallableCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -1,29 +0,0 @@
-package org.jboss.cache.commands;
-
-/**
- * Declares methods to expose internals of the command such that a {@link org.jboss.cache.marshall.Marshaller} is able to
- * marshall the command for streaming over the wire.
- *
- * @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
- * @since 2.2.0
- */
-public interface MarshallableCommand extends CacheCommand
-{
- /**
- * @return the method id of this command. This is compatible with pre-2.2.0 MethodCall ids.
- */
- int getCommandId();
-
- /**
- * @return an object array of arguments, compatible with pre-2.2.0 MethodCall args.
- */
- Object[] getParameters();
-
- /**
- * Sets the state of a command instance with unmarshalled command id and args.
- *
- * @param commandId command id to set. This is usually unused but *could* be used in the event of a command having multiple IDs, such as {@link org.jboss.cache.commands.cachedata.PutKeyValueCommand}.
- * @param args object array of args
- */
- void setState(int commandId, Object[] args);
-}
Deleted: core/trunk/src/main/java/org/jboss/cache/commands/TxCacheCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/TxCacheCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/TxCacheCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -1,12 +0,0 @@
-package org.jboss.cache.commands;
-
-/**
- * Base class for commands that also suppor rollback.
- *
- * @author Mircea.Markus(a)jboss.com
- * @since 2.2
- */
-public interface TxCacheCommand extends CacheCommand
-{
- public abstract void rollback();
-}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/CacheDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/CacheDataCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/CacheDataCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -2,7 +2,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.MarshallableCommand;
+import org.jboss.cache.commands.functional.MarshallableCommand;
/**
* Defines a command that manipulates data on cache.
Copied: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/EvictFqnCommand.java (from rev 5546, core/trunk/src/main/java/org/jboss/cache/commands/EvictFqnCommand.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/EvictFqnCommand.java (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/EvictFqnCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -0,0 +1,89 @@
+package org.jboss.cache.commands.cachedata;
+
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.commands.state.DataVersionCommand;
+import org.jboss.cache.commands.BaseCommand;
+import org.jboss.cache.commands.CommandsVisitor;
+import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.invocation.CacheData;
+import org.jboss.cache.optimistic.DataVersion;
+
+/**
+ * Implements functionality defined by {@link org.jboss.cache.CacheSPI#evict(org.jboss.cache.Fqn)}
+ *
+ * @author Mircea.Markus(a)jboss.com
+ * @since 2.2
+ */
+public class EvictFqnCommand extends BaseCommand implements DataVersionCommand
+{
+ public static final int METHOD_ID = 8;
+ public static final int VERSIONED_METHOD_ID = 9;
+
+ /* dependencies*/
+ protected CacheData cacheData;
+
+ /* parameters*/
+ protected Fqn fqn;
+ protected DataVersion dataVersion;
+
+ public EvictFqnCommand(Fqn fqn)
+ {
+ this.fqn = fqn;
+ }
+
+ @Inject
+ public void initialize(CacheData cacheData)
+ {
+ this.cacheData = cacheData;
+ }
+
+ public Object perform(InvocationContext ctx)
+ {
+ return cacheData.evict(fqn);
+ }
+
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
+ {
+ return handler.handleEvictFqnCommand(ctx, this);
+ }
+
+ public int getCommandId()
+ {
+ return isVersioned() ? VERSIONED_METHOD_ID : METHOD_ID;
+ }
+
+ public Fqn getFqn()
+ {
+ return fqn;
+ }
+
+ public DataVersion getDataVersion()
+ {
+ return dataVersion;
+ }
+
+ public void setDataVersion(DataVersion dataVersion)
+ {
+ this.dataVersion = dataVersion;
+ }
+
+ public boolean isVersioned()
+ {
+ return dataVersion != null;
+ }
+
+ public Object[] getParameters()
+ {
+ if (isVersioned())
+ return new Object[]{fqn, dataVersion};
+ else
+ return new Object[]{fqn};
+ }
+
+ public void setState(int commandId, Object[] args)
+ {
+ fqn = (Fqn) args[0];
+ if (commandId == VERSIONED_METHOD_ID) dataVersion = (DataVersion) args[1];
+ }
+}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/ExistsNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/ExistsNodeCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/ExistsNodeCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -3,8 +3,8 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Node;
-import org.jboss.cache.commands.BaseCacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.commands.BaseCommand;
+import org.jboss.cache.commands.CommandsVisitor;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
@@ -17,7 +17,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class ExistsNodeCommand extends BaseCacheCommand implements CacheDataCommand
+public class ExistsNodeCommand extends BaseCommand implements CacheDataCommand
{
public static final int METHOD_ID = 16;
@@ -46,7 +46,7 @@
return n != null;
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleExistsNodeCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetChildrenNamesCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetChildrenNamesCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetChildrenNamesCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -3,8 +3,8 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.commands.BaseCommand;
+import org.jboss.cache.commands.CommandsVisitor;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
@@ -18,7 +18,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class GetChildrenNamesCommand extends BaseCacheCommand implements CacheDataCommand
+public class GetChildrenNamesCommand extends BaseCommand implements CacheDataCommand
{
public static final int METHOD_ID = 23;
@@ -63,7 +63,7 @@
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleGetChildrenNamesCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetDataMapCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetDataMapCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetDataMapCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -3,8 +3,8 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.commands.BaseCommand;
+import org.jboss.cache.commands.CommandsVisitor;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
@@ -14,7 +14,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class GetDataMapCommand extends BaseCacheCommand implements CacheDataCommand
+public class GetDataMapCommand extends BaseCommand implements CacheDataCommand
{
public static final int METHOD_ID = 24;
@@ -44,7 +44,7 @@
return n.getDataDirect();
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleGetDataMapCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeyValueCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeyValueCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeyValueCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -5,8 +5,8 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.commands.BaseCommand;
+import org.jboss.cache.commands.CommandsVisitor;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.notifications.Notifier;
@@ -17,7 +17,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class GetKeyValueCommand extends BaseCacheCommand implements CacheDataCommand
+public class GetKeyValueCommand extends BaseCommand implements CacheDataCommand
{
public static final int METHOD_ID = 26;
@@ -69,7 +69,7 @@
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleGetKeyValueCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeysCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeysCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeysCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -3,8 +3,8 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.commands.BaseCommand;
+import org.jboss.cache.commands.CommandsVisitor;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
@@ -17,7 +17,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class GetKeysCommand extends BaseCacheCommand implements CacheDataCommand
+public class GetKeysCommand extends BaseCommand implements CacheDataCommand
{
public static final int METHOD_ID = 25;
@@ -51,7 +51,7 @@
return new HashSet(keys);
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleGetKeysCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetNodeCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetNodeCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -2,8 +2,8 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.BaseCacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.commands.BaseCommand;
+import org.jboss.cache.commands.CommandsVisitor;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
@@ -13,7 +13,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class GetNodeCommand extends BaseCacheCommand implements CacheDataCommand
+public class GetNodeCommand extends BaseCommand implements CacheDataCommand
{
public static final int METHOD_ID = 31;
@@ -41,7 +41,7 @@
return cacheData.findNode(fqn);
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleGetNodeCommand(ctx, this);
}
Copied: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/InvalidateCommand.java (from rev 5546, core/trunk/src/main/java/org/jboss/cache/commands/InvalidateCommand.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/InvalidateCommand.java (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/InvalidateCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -0,0 +1,152 @@
+package org.jboss.cache.commands.cachedata;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.*;
+import org.jboss.cache.commands.CommandsVisitor;
+import org.jboss.cache.config.Option;
+import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.invocation.CacheData;
+import org.jboss.cache.notifications.Notifier;
+import org.jboss.cache.optimistic.DataVersion;
+
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import java.util.Collections;
+import java.util.Map;
+
+/**
+ * Very much like an evict(), except that regardless of whether there is a child present, this call will never
+ * remove the node from memory - just remove its contents.
+ * <p/>
+ * Also, potentially throws a cache exception if data versioning is used and the node in memory has a newer data
+ * version than what is passed in.
+ * <p/>
+ * Finally, the data version of the in-memory node is updated to the version being evicted to prevent versions
+ * going out of sync.
+ *
+ * @author Mircea.Markus(a)jboss.com
+ * @since 2.2
+ */
+public class InvalidateCommand extends EvictFqnCommand
+{
+ private static final Log log = LogFactory.getLog(InvalidateCommand.class);
+
+ /* dependencies*/
+ private boolean isOptimisticLocking;
+ private Notifier notifier;
+ private CacheSPI cacheSpi;//todo this is ugly, revisit
+ private TransactionManager transactionManager;
+
+ public InvalidateCommand(Fqn fqn)
+ {
+ super(fqn);
+ }
+
+ @Inject
+ public void initialize(CacheData cacheData, Notifier notifier, CacheSPI cacheSPI, TransactionManager txManager, boolean isOptimisticLocking)
+ {
+ super.initialize(cacheData);
+ this.notifier = notifier;
+ this.cacheSpi = cacheSPI;
+ this.transactionManager = txManager;
+ this.isOptimisticLocking = isOptimisticLocking;
+ }
+
+ public Object perform(InvocationContext ctx)
+ {
+ Node node = cacheSpi.getNode(fqn); // force interceptor chain, load if necessary from cache loader.
+
+ if (node == null)
+ {
+ // if pessimistic locking, just return.
+ if (!isOptimisticLocking) return null;
+
+ // check if a tombstone already exists
+ NodeSPI nodeSPI = cacheData.peek(fqn, false, true);
+ if (nodeSPI == null)
+ {
+ if (dataVersion == null)
+ {
+ if (log.isTraceEnabled())
+ log.trace("Would have created a tombstone since the node doesn't exist, but the version to invalidate is null and hence cannot create a tombstone!");
+ return null;
+ }
+ if (log.isTraceEnabled())
+ log.trace("Node doesn't exist; creating a tombstone with data version " + dataVersion);
+ // create the node we need.
+ Map m = Collections.emptyMap();
+ InvocationContext ic = cacheSpi.getInvocationContext();
+ Option o = ic.getOptionOverrides();
+ boolean origCacheModeLocal = o.isCacheModeLocal();
+ o.setCacheModeLocal(true);
+ o.setDataVersion(dataVersion);
+ // if we are in a tx this call should happen outside of any tx
+ try
+ {
+ Transaction suspended = null;
+ if (transactionManager != null)
+ {
+ suspended = transactionManager.suspend();
+ }
+ cacheSpi.put(fqn, m);
+ if (suspended != null) transactionManager.resume(suspended);
+ ic.getOptionOverrides().setCacheModeLocal(origCacheModeLocal);
+ }
+ catch (Exception e)
+ {
+ log.error("Unable to create tombstone!", e);
+ }
+ nodeSPI = (NodeSPI) cacheData.getRoot().getChild(fqn);
+ }
+ node = nodeSPI;
+ }
+
+ if (isOptimisticLocking)
+ removeData();
+ else
+ super.perform(ctx);
+
+ // mark the node to be removed (and all children) as invalid so anyone holding a direct reference to it will
+ // be aware that it is no longer valid.
+ ((NodeSPI) node).setValid(false, true);
+
+ if (dataVersion != null)
+ {
+ NodeSPI n = cacheData.peek(fqn, false, true);
+ n.setVersion(dataVersion);
+ }
+ return null;
+ }
+
+ public void removeData()
+ throws CacheException
+ {
+ // Find the node. This will lock it (if <tt>locking</tt> is true) and
+ // add the temporarily created parent nodes to the TX's node list if tx != null)
+ NodeSPI n = cacheData.findNode(fqn, dataVersion);
+ if (n == null)
+ {
+ log.warn("node " + fqn + " not found");
+ return;
+ }
+ InvocationContext ctx = cacheSpi.getInvocationContext();
+ notifier.notifyNodeEvicted(fqn, true, ctx);
+ n.clearDataDirect();
+ n.setDataLoaded(false);
+
+ // FIXME Bela did this so GUI view can refresh the view after node is evicted. But this breaks eviction policy, especially AOP!!!!
+ notifier.notifyNodeEvicted(fqn, false, ctx);
+ }
+
+
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
+ {
+ return handler.handleInvalidateCommand(ctx, this);
+ }
+
+ public DataVersion getVersionToInvalidate()
+ {
+ return dataVersion;
+ }
+}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/MoveCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/MoveCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/MoveCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -4,9 +4,9 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeNotExistsException;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
-import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.commands.BaseCommand;
+import org.jboss.cache.commands.CommandsVisitor;
+import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.notifications.Notifier;
@@ -18,7 +18,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class MoveCommand extends BaseCacheCommand implements TxCacheCommand, CacheDataCommand
+public class MoveCommand extends BaseCommand implements TxCacheCommand, CacheDataCommand
{
public static final int METHOD_ID = 36;
@@ -67,7 +67,7 @@
node.setFqn(newFqn);
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleMoveCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -5,11 +5,11 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
-import org.jboss.cache.commands.DataVersionCommand;
-import org.jboss.cache.commands.GlobalTransactionCommand;
-import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.commands.BaseCommand;
+import org.jboss.cache.commands.CommandsVisitor;
+import org.jboss.cache.commands.state.DataVersionCommand;
+import org.jboss.cache.commands.state.GlobalTransactionCommand;
+import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.notifications.Notifier;
@@ -26,7 +26,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class PutDataMapCommand extends BaseCacheCommand implements TxCacheCommand, CacheDataCommand, DataVersionCommand, GlobalTransactionCommand
+public class PutDataMapCommand extends BaseCommand implements TxCacheCommand, CacheDataCommand, DataVersionCommand, GlobalTransactionCommand
{
public static final int METHOD_ID = 1;
public static final int ERASE_METHOD_ID = 2;
@@ -105,7 +105,7 @@
n.putAllDirect(oldData);
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handlePutDataMapCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -5,11 +5,11 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
-import org.jboss.cache.commands.DataVersionCommand;
-import org.jboss.cache.commands.GlobalTransactionCommand;
-import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.commands.BaseCommand;
+import org.jboss.cache.commands.CommandsVisitor;
+import org.jboss.cache.commands.state.DataVersionCommand;
+import org.jboss.cache.commands.state.GlobalTransactionCommand;
+import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.notifications.Notifier;
@@ -27,7 +27,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class PutKeyValueCommand extends BaseCacheCommand implements TxCacheCommand, CacheDataCommand, DataVersionCommand, GlobalTransactionCommand
+public class PutKeyValueCommand extends BaseCommand implements TxCacheCommand, CacheDataCommand, DataVersionCommand, GlobalTransactionCommand
{
public static final int METHOD_ID = 3;
public static final int VERSIONED_METHOD_ID = 39;
@@ -117,7 +117,7 @@
}
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handlePutKeyValueCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveDataCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveDataCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -5,11 +5,11 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
-import org.jboss.cache.commands.DataVersionCommand;
-import org.jboss.cache.commands.GlobalTransactionCommand;
-import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.commands.BaseCommand;
+import org.jboss.cache.commands.*;
+import org.jboss.cache.commands.state.DataVersionCommand;
+import org.jboss.cache.commands.state.GlobalTransactionCommand;
+import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.notifications.Notifier;
@@ -27,7 +27,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class RemoveDataCommand extends BaseCacheCommand implements TxCacheCommand, DataVersionCommand, GlobalTransactionCommand
+public class RemoveDataCommand extends BaseCommand implements TxCacheCommand, DataVersionCommand, GlobalTransactionCommand
{
public static final int METHOD_ID = 7;
public static final int VERSIONED_METHOD_ID = 42;
@@ -152,7 +152,7 @@
nodeSPI.putAllDirect(originalData);
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleRemoveDataCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveKeyCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveKeyCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveKeyCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -5,11 +5,11 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
-import org.jboss.cache.commands.DataVersionCommand;
-import org.jboss.cache.commands.GlobalTransactionCommand;
-import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.commands.BaseCommand;
+import org.jboss.cache.commands.CommandsVisitor;
+import org.jboss.cache.commands.state.DataVersionCommand;
+import org.jboss.cache.commands.state.GlobalTransactionCommand;
+import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.notifications.Notifier;
@@ -27,7 +27,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class RemoveKeyCommand extends BaseCacheCommand implements TxCacheCommand, CacheDataCommand, DataVersionCommand, GlobalTransactionCommand
+public class RemoveKeyCommand extends BaseCommand implements TxCacheCommand, CacheDataCommand, DataVersionCommand, GlobalTransactionCommand
{
public static final int METHOD_ID = 6;
public static final int VERSIONED_METHOD_ID = 41;
@@ -100,7 +100,7 @@
targetNode.putDirect(key, oldValue);
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleRemoveKeyCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -5,11 +5,11 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
-import org.jboss.cache.commands.DataVersionCommand;
-import org.jboss.cache.commands.GlobalTransactionCommand;
-import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.commands.BaseCommand;
+import org.jboss.cache.commands.CommandsVisitor;
+import org.jboss.cache.commands.state.DataVersionCommand;
+import org.jboss.cache.commands.state.GlobalTransactionCommand;
+import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
@@ -24,7 +24,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class RemoveNodeCommand extends BaseCacheCommand implements TxCacheCommand, CacheDataCommand, DataVersionCommand, GlobalTransactionCommand
+public class RemoveNodeCommand extends BaseCommand implements TxCacheCommand, CacheDataCommand, DataVersionCommand, GlobalTransactionCommand
{
public static final int METHOD_ID = 5;
public static final int VERSIONED_METHOD_ID = 40;
@@ -173,7 +173,7 @@
targetNode.setValid(true, true);
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleRemoveNodeCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/channel/BlockChannelCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/channel/BlockChannelCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/channel/BlockChannelCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -1,9 +1,9 @@
package org.jboss.cache.commands.channel;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.BaseCacheCommand;
+import org.jboss.cache.commands.BaseCommand;
import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.commands.CommandsVisitor;
/**
* todo - this is only used by notification interceptor, guess it can be removed and notifications
@@ -12,7 +12,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class BlockChannelCommand extends BaseCacheCommand implements CacheCommand
+public class BlockChannelCommand extends BaseCommand implements CacheCommand
{
public static final int METHOD_ID = 43;
@@ -25,7 +25,7 @@
return null;
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleBlockChannelCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/channel/UnblockChannelCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/channel/UnblockChannelCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/channel/UnblockChannelCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -1,9 +1,9 @@
package org.jboss.cache.commands.channel;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.BaseCacheCommand;
+import org.jboss.cache.commands.BaseCommand;
import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.commands.CommandsVisitor;
/**
* todo - this is only used by notification interceptor, guess it can be removed and notifications
@@ -12,7 +12,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class UnblockChannelCommand extends BaseCacheCommand implements CacheCommand
+public class UnblockChannelCommand extends BaseCommand implements CacheCommand
{
public static final int METHOD_ID = 43;
@@ -26,7 +26,7 @@
return null;
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleUnblockChannelCommand(ctx, this);
}
Copied: core/trunk/src/main/java/org/jboss/cache/commands/functional/MarshallableCommand.java (from rev 5546, core/trunk/src/main/java/org/jboss/cache/commands/MarshallableCommand.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/functional/MarshallableCommand.java (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/commands/functional/MarshallableCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -0,0 +1,31 @@
+package org.jboss.cache.commands.functional;
+
+import org.jboss.cache.commands.CacheCommand;
+
+/**
+ * Declares methods to expose internals of the command such that a {@link org.jboss.cache.marshall.Marshaller} is able to
+ * marshall the command for streaming over the wire.
+ *
+ * @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
+ * @since 2.2.0
+ */
+public interface MarshallableCommand extends CacheCommand
+{
+ /**
+ * @return the method id of this command. This is compatible with pre-2.2.0 MethodCall ids.
+ */
+ int getCommandId();
+
+ /**
+ * @return an object array of arguments, compatible with pre-2.2.0 MethodCall args.
+ */
+ Object[] getParameters();
+
+ /**
+ * Sets the state of a command instance with unmarshalled command id and args.
+ *
+ * @param commandId command id to set. This is usually unused but *could* be used in the event of a command having multiple IDs, such as {@link org.jboss.cache.commands.cachedata.PutKeyValueCommand}.
+ * @param args object array of args
+ */
+ void setState(int commandId, Object[] args);
+}
Copied: core/trunk/src/main/java/org/jboss/cache/commands/functional/TxCacheCommand.java (from rev 5546, core/trunk/src/main/java/org/jboss/cache/commands/TxCacheCommand.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/functional/TxCacheCommand.java (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/commands/functional/TxCacheCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -0,0 +1,14 @@
+package org.jboss.cache.commands.functional;
+
+import org.jboss.cache.commands.CacheCommand;
+
+/**
+ * Base class for commands that also suppor rollback.
+ *
+ * @author Mircea.Markus(a)jboss.com
+ * @since 2.2
+ */
+public interface TxCacheCommand extends CacheCommand
+{
+ public abstract void rollback();
+}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -4,9 +4,9 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.commands.BaseCacheCommand;
+import org.jboss.cache.commands.BaseCommand;
import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.commands.CommandsVisitor;
import org.jboss.cache.factories.annotations.Inject;
import org.jgroups.Address;
@@ -14,7 +14,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class AnnounceBuddyPoolNameCommand extends BaseCacheCommand implements CacheCommand
+public class AnnounceBuddyPoolNameCommand extends BaseCommand implements CacheCommand
{
public static final int METHOD_ID = 28;
private static final Log log = LogFactory.getLog(AnnounceBuddyPoolNameCommand.class);
@@ -52,7 +52,7 @@
return null;
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleAnnounceBuddyPoolName(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -6,9 +6,9 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.buddyreplication.BuddyGroup;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.commands.BaseCacheCommand;
+import org.jboss.cache.commands.BaseCommand;
import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.commands.CommandsVisitor;
import org.jboss.cache.factories.annotations.Inject;
import java.util.Map;
@@ -17,7 +17,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class AssignToBuddyGroupCommand extends BaseCacheCommand implements CacheCommand
+public class AssignToBuddyGroupCommand extends BaseCommand implements CacheCommand
{
public static final int METHOD_ID = 29;
private static final Log log = LogFactory.getLog(AssignToBuddyGroupCommand.class);
@@ -53,7 +53,7 @@
return null;
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleAssignToBuddyGroupCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -3,9 +3,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.BaseCacheCommand;
+import org.jboss.cache.commands.BaseCommand;
import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.commands.CommandsVisitor;
import org.jboss.cache.commands.cachedata.CacheDataCommand;
import org.jboss.cache.commands.cachedata.ExistsNodeCommand;
import org.jboss.cache.commands.cachedata.GetChildrenNamesCommand;
@@ -21,7 +21,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class ClusteredGetCommand extends BaseCacheCommand implements CacheCommand
+public class ClusteredGetCommand extends BaseCommand implements CacheCommand
{
public static final int METHOD_ID = 22;
private static final Log log = LogFactory.getLog(ClusteredGetCommand.class);
@@ -82,7 +82,7 @@
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleClusteredGetCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -6,13 +6,12 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.commands.BaseCacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
-import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.EvictFqnCommand;
-import org.jboss.cache.commands.GlobalTransactionCommand;
-import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.commands.BaseCommand;
+import org.jboss.cache.commands.*;
+import org.jboss.cache.commands.state.GlobalTransactionCommand;
+import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.commands.cachedata.RemoveNodeCommand;
+import org.jboss.cache.commands.cachedata.EvictFqnCommand;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.invocation.CacheTransactionHelper;
@@ -29,7 +28,7 @@
* todo this calls other commands through the invocation chain, check wheter direct call is not okay
* todo it is not natural for this command to extend TxCC, revisit
*/
-public class DataGravitationCleanupCommand extends BaseCacheCommand implements TxCacheCommand, GlobalTransactionCommand
+public class DataGravitationCleanupCommand extends BaseCommand implements TxCacheCommand, GlobalTransactionCommand
{
public static final int METHOD_ID = 34;
private static final Log log = LogFactory.getLog(DataGravitationCleanupCommand.class);
@@ -140,7 +139,7 @@
}
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleDataGravitationCleanupCommand(ctx, this);
}
Copied: core/trunk/src/main/java/org/jboss/cache/commands/remote/GravitateDataCommand.java (from rev 5546, core/trunk/src/main/java/org/jboss/cache/commands/GravitateDataCommand.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/GravitateDataCommand.java (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/GravitateDataCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -0,0 +1,191 @@
+package org.jboss.cache.commands.remote;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.Node;
+import org.jboss.cache.NodeSPI;
+import org.jboss.cache.RPCManager;
+import org.jboss.cache.commands.BaseCommand;
+import org.jboss.cache.commands.CacheCommand;
+import org.jboss.cache.commands.CommandsVisitor;
+import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
+import org.jboss.cache.buddyreplication.BuddyManager;
+import org.jboss.cache.buddyreplication.GravitateResult;
+import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.invocation.CacheData;
+import org.jboss.cache.marshall.NodeData;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+/**
+ * Used with buddy replication's data gravitation interceptor. If marshalling is necessary, ensure that the cache is
+ * configured to use {@link org.jboss.cache.config.Configuration#useRegionBasedMarshalling} and the {@link org.jboss.cache.Region}
+ * pertaining to the Fqn passed in is activated, and has an appropriate ClassLoader.
+ * todo - this should not be a command as none relally visits it. It was inherited this way from old CacheImpl
+ */
+public class GravitateDataCommand extends BaseCommand implements CacheCommand
+{
+ public static final int METHOD_ID = 35;
+ private static final Log log = LogFactory.getLog(GravitateDataCommand.class);
+
+ /* dependencies */
+ private CacheSPI spi; //todo ugly dependency, revisit
+ private RPCManager rpcManager;
+ private CacheData cacheData;
+
+ /* parametres */
+ private Fqn fqn;
+ private boolean searchSubtrees;
+
+ public GravitateDataCommand(Fqn fqn, boolean searchSubtrees)
+ {
+ this.fqn = fqn;
+ this.searchSubtrees = searchSubtrees;
+ }
+
+ @Inject
+ public void initialize(CacheSPI spi, RPCManager manager, CacheData cacheData)
+ {
+ this.spi = spi;
+ this.rpcManager = manager;
+ this.cacheData = cacheData;
+ }
+
+ public Object perform(InvocationContext ctx)
+ {
+ // for now, perform a very simple series of getData calls.
+ if (log.isTraceEnabled()) log.trace("Caller is asking for " + fqn);
+ try
+ {
+ ctx.setOriginLocal(false);
+ // use a get() call into the cache to make sure cache loading takes place.
+ // no need to cache the original skipDataGravitation setting here - it will always be false of we got here!!
+ ctx.getOptionOverrides().setSkipDataGravitation(true);
+ Node actualNode = spi.getNode(fqn);
+ ctx.getOptionOverrides().setSkipDataGravitation(false);
+
+ if (log.isTraceEnabled()) log.trace("In local tree, this is " + actualNode);
+
+ Fqn backupNodeFqn = null;
+ if (actualNode == null && searchSubtrees)
+ {
+ log.trace("Looking at backup trees.");
+ NodeSPI backupSubtree = cacheData.findNode(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN);
+ if (backupSubtree != null)
+ {
+ // need to loop through backupSubtree's children
+ Set childNames = backupSubtree.getChildrenNamesDirect();
+ if (childNames != null)
+ {
+ for (Object childName : childNames)
+ {
+ // childName is the name of a buddy group since all child names in this
+ // collection are direct children of BUDDY_BACKUP_SUBTREE_FQN
+ Fqn backupRoot = Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, childName);
+ if (BuddyManager.isDeadBackupRoot(backupRoot))
+ {
+ //actualNode = searchDeadRoot(backupRoot, fqn);
+ Set<Integer> deadChildNames = new TreeSet<Integer>(spi.getChildrenNames(backupRoot));
+ Integer[] elems = deadChildNames.toArray(new Integer[]{});
+
+ // these are integers. we need to start with the highest/most recent.
+ for (int i = elems.length - 1; i > -1; i--)
+ {
+ Integer versionOfDefunctData = elems[i];
+ backupNodeFqn = Fqn.fromRelativeFqn(Fqn.fromRelativeElements(backupRoot, versionOfDefunctData), fqn);
+
+ // use a get() call into the cache to make sure cache loading takes place.
+ ctx.getOptionOverrides().setSkipDataGravitation(true);
+ actualNode = spi.peek(backupNodeFqn, false);
+ ctx.getOptionOverrides().setSkipDataGravitation(false);
+
+ // break out of the inner loop searching through the dead node's various backups
+ if (actualNode != null) break;
+ }
+ }
+ else
+ {
+ backupNodeFqn = Fqn.fromRelativeFqn(backupRoot, fqn);
+ // use a get() call into the cache to make sure cache loading takes place.
+ ctx.getOptionOverrides().setSkipDataGravitation(true);
+ actualNode = spi.getNode(backupNodeFqn);
+ ctx.getOptionOverrides().setSkipDataGravitation(false);
+ }
+
+ if (log.isTraceEnabled())
+ log.trace("Looking for " + backupNodeFqn + ". Search result: " + actualNode);
+
+ // break out of outer loop searching through all available backups.
+ if (actualNode != null) break;
+ }
+ }
+ }
+ }
+
+ if (actualNode == null)
+ {
+ return GravitateResult.noDataFound();
+ }
+ else
+ {
+ // make sure we LOAD data for this node!!
+ actualNode.getData();
+ }
+
+ if (backupNodeFqn == null && searchSubtrees)
+ {
+ backupNodeFqn = BuddyFqnTransformer.getBackupFqn(BuddyManager.getGroupNameFromAddress(rpcManager.getLocalAddress()), fqn);
+ }
+
+ List<NodeData> list = cacheData.getNodeData(new LinkedList<NodeData>(), (NodeSPI) actualNode);
+
+ return GravitateResult.subtreeResult(list, backupNodeFqn);
+ }
+ catch (RuntimeException re)
+ {
+ if (log.isTraceEnabled()) log.trace("Caught throwable", re);
+ throw re;
+ }
+ finally
+ {
+ ctx.setOriginLocal(true);
+ }
+ }
+
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
+ {
+ return handler.handleGravitateDataCommand(ctx, this);
+ }
+
+ public int getCommandId()
+ {
+ return METHOD_ID;
+ }
+
+ public Fqn getFqn()
+ {
+ return fqn;
+ }
+
+ public boolean isSearchSubtrees()
+ {
+ return searchSubtrees;
+ }
+
+ public Object[] getParameters()
+ {
+ return new Object[]{fqn, searchSubtrees};
+ }
+
+ public void setState(int commandId, Object[] args)
+ {
+ fqn = (Fqn) args[0];
+ searchSubtrees = (Boolean) args[1];
+ }
+}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -4,16 +4,16 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.commands.BaseCacheCommand;
+import org.jboss.cache.commands.BaseCommand;
import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.commands.CommandsVisitor;
import org.jboss.cache.factories.annotations.Inject;
/**
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class RemoveFromBuddyGroupCommand extends BaseCacheCommand implements CacheCommand
+public class RemoveFromBuddyGroupCommand extends BaseCommand implements CacheCommand
{
public static final int METHOD_ID = 30;
private static final Log log = LogFactory.getLog(RemoveFromBuddyGroupCommand.class);
@@ -46,7 +46,7 @@
return null;
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleRemoveFromBuddyGroupCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -1,11 +1,9 @@
package org.jboss.cache.commands.remote;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.BaseCacheCommand;
-import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
-import org.jboss.cache.commands.GravitateDataCommand;
-import org.jboss.cache.commands.MarshallableCommand;
+import org.jboss.cache.commands.BaseCommand;
+import org.jboss.cache.commands.*;
+import org.jboss.cache.commands.functional.MarshallableCommand;
import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.InterceptorChain;
@@ -20,7 +18,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class ReplicateCommand extends BaseCacheCommand implements CacheCommand
+public class ReplicateCommand extends BaseCommand implements CacheCommand
{
public static final int SINGLE_METHOD_ID = 13;
public static final int MULTIPLE_METHOD_ID = 14;
@@ -109,7 +107,7 @@
return cacheCommand instanceof GravitateDataCommand || cacheCommand instanceof ClusteredGetCommand;
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleReplicateCommand(ctx, this);
}
Copied: core/trunk/src/main/java/org/jboss/cache/commands/state/DataVersionCommand.java (from rev 5546, core/trunk/src/main/java/org/jboss/cache/commands/DataVersionCommand.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/state/DataVersionCommand.java (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/commands/state/DataVersionCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -0,0 +1,23 @@
+package org.jboss.cache.commands.state;
+
+import org.jboss.cache.optimistic.DataVersion;
+import org.jboss.cache.commands.CacheCommand;
+
+/**
+ * Commands that know how to deal with versioned data.
+ *
+ * @author Mircea.Markus(a)jboss.com
+ * @since 2.2
+ */
+public interface DataVersionCommand extends CacheCommand
+{
+ public DataVersion getDataVersion();
+
+ public void setDataVersion(DataVersion dataVersion);
+
+ /**
+ * Has data version set? (i.e. not null)
+ * // todo: should this be an abstract class rather than an interface? isVersioned() is implemented exactly the same way in all subclasses.
+ */
+ public boolean isVersioned();
+}
Copied: core/trunk/src/main/java/org/jboss/cache/commands/state/GlobalTransactionCommand.java (from rev 5546, core/trunk/src/main/java/org/jboss/cache/commands/GlobalTransactionCommand.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/state/GlobalTransactionCommand.java (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/commands/state/GlobalTransactionCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -0,0 +1,15 @@
+package org.jboss.cache.commands.state;
+
+import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.cache.commands.CacheCommand;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ * @since 2.2
+ */
+public interface GlobalTransactionCommand extends CacheCommand
+{
+ public GlobalTransaction getGlobalTransaction();
+
+ void setGlobalTransaction(GlobalTransaction gtx);
+}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/tx/CommitCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/tx/CommitCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/tx/CommitCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -1,16 +1,16 @@
package org.jboss.cache.commands.tx;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.BaseCacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
-import org.jboss.cache.commands.GlobalTransactionCommand;
+import org.jboss.cache.commands.BaseCommand;
+import org.jboss.cache.commands.CommandsVisitor;
+import org.jboss.cache.commands.state.GlobalTransactionCommand;
import org.jboss.cache.transaction.GlobalTransaction;
/**
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class CommitCommand extends BaseCacheCommand implements GlobalTransactionCommand
+public class CommitCommand extends BaseCommand implements GlobalTransactionCommand
{
public static final int METHOD_ID = 11;
@@ -31,7 +31,7 @@
return null;
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleCommitCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -2,7 +2,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.commands.CommandsVisitor;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jgroups.Address;
@@ -33,7 +33,7 @@
return null;
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleOptimisticPrepareCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -1,10 +1,10 @@
package org.jboss.cache.commands.tx;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.BaseCacheCommand;
+import org.jboss.cache.commands.BaseCommand;
import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
-import org.jboss.cache.commands.GlobalTransactionCommand;
+import org.jboss.cache.commands.CommandsVisitor;
+import org.jboss.cache.commands.state.GlobalTransactionCommand;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jgroups.Address;
@@ -16,7 +16,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class PrepareCommand extends BaseCacheCommand implements CacheCommand, GlobalTransactionCommand
+public class PrepareCommand extends BaseCommand implements CacheCommand, GlobalTransactionCommand
{
public static final int METHOD_ID = 10;
@@ -37,7 +37,7 @@
this.onePhaseCommit = onePhaseCommit;
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handlePrepareCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/tx/RollbackCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/tx/RollbackCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/tx/RollbackCommand.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -1,17 +1,17 @@
package org.jboss.cache.commands.tx;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.BaseCacheCommand;
+import org.jboss.cache.commands.BaseCommand;
import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.CacheCommandsVisitor;
-import org.jboss.cache.commands.GlobalTransactionCommand;
+import org.jboss.cache.commands.CommandsVisitor;
+import org.jboss.cache.commands.state.GlobalTransactionCommand;
import org.jboss.cache.transaction.GlobalTransaction;
/**
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class RollbackCommand extends BaseCacheCommand implements CacheCommand, GlobalTransactionCommand
+public class RollbackCommand extends BaseCommand implements CacheCommand, GlobalTransactionCommand
{
public static final int METHOD_ID = 12;
@@ -31,7 +31,7 @@
return null;
}
- public Object accept(InvocationContext ctx, CacheCommandsVisitor handler) throws Throwable
+ public Object accept(InvocationContext ctx, CommandsVisitor handler) throws Throwable
{
return handler.handleRollbackCommand(ctx, this);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/visitors/AbstractCommandsVisitor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/visitors/AbstractCommandsVisitor.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/visitors/AbstractCommandsVisitor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -17,7 +17,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class AbstractCommandsVisitor implements CacheCommandsVisitor
+public class AbstractCommandsVisitor implements CommandsVisitor
{
public Object handlePutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable
{
Modified: core/trunk/src/main/java/org/jboss/cache/commands/visitors/DataVersionCommandsVisitor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/visitors/DataVersionCommandsVisitor.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/visitors/DataVersionCommandsVisitor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -2,11 +2,11 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.cachedata.*;
-import org.jboss.cache.commands.DataVersionCommand;
+import org.jboss.cache.commands.state.DataVersionCommand;
/**
- * Similar to {@link AbstractCommandsVisitor} but delegates the handlers of {@link org.jboss.cache.commands.DataVersionCommand}
- * to {@link #handleDataVersionCommand(org.jboss.cache.InvocationContext,org.jboss.cache.commands.DataVersionCommand)}.
+ * Similar to {@link AbstractCommandsVisitor} but delegates the handlers of {@link org.jboss.cache.commands.state.DataVersionCommand}
+ * to {@link #handleDataVersionCommand(org.jboss.cache.InvocationContext, org.jboss.cache.commands.state.DataVersionCommand)}.
* All other handlers are delegated by default to
* {@link #handleDefault(org.jboss.cache.InvocationContext, org.jboss.cache.commands.CacheCommand)}
*
Modified: core/trunk/src/main/java/org/jboss/cache/commands/visitors/GlobalTransactionCommandsVisitor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/visitors/GlobalTransactionCommandsVisitor.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/commands/visitors/GlobalTransactionCommandsVisitor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -2,7 +2,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.cachedata.*;
-import org.jboss.cache.commands.GlobalTransactionCommand;
+import org.jboss.cache.commands.state.GlobalTransactionCommand;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
Modified: core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -45,6 +45,7 @@
* </ul>
* <p/>
* Cache configuration can only be changed and will only be reinjected if the cache is not in the {@link org.jboss.cache.CacheStatus#STARTED} state.
+ * todo [mmarkus] remove dependecies on components from this class and move it elsewhere (e.g. dependecy on CacgeSPI, Configuration etc)
*
* @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
* @since 2.1.0
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -9,7 +9,7 @@
import org.jboss.cache.cluster.ReplicationQueue;
import org.jboss.cache.commands.CacheCommand;
import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.MarshallableCommand;
+import org.jboss.cache.commands.functional.MarshallableCommand;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.config.Option;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -24,12 +24,11 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.base.ChainedInterceptor;
-import org.jboss.cache.commands.EvictFqnCommand;
+import org.jboss.cache.commands.cachedata.EvictFqnCommand;
import org.jboss.cache.commands.cachedata.GetKeyValueCommand;
import org.jboss.cache.commands.cachedata.PutDataMapCommand;
import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
import org.jboss.cache.invocation.CacheData;
-import org.apache.commons.logging.LogFactory;
import java.util.HashMap;
import java.util.Map;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -5,7 +5,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Modification;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.commands.cachedata.MoveCommand;
import org.jboss.cache.commands.cachedata.PutDataMapCommand;
import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -2,7 +2,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.commands.cachedata.PutDataMapCommand;
import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
import org.jboss.cache.commands.cachedata.RemoveDataCommand;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -15,7 +15,7 @@
import org.jboss.cache.buddyreplication.GravitateResult;
import org.jboss.cache.commands.CacheCommand;
import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.GravitateDataCommand;
+import org.jboss.cache.commands.remote.GravitateDataCommand;
import org.jboss.cache.commands.cachedata.*;
import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
import org.jboss.cache.commands.tx.CommitCommand;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -8,14 +8,13 @@
package org.jboss.cache.interceptors;
import org.jboss.cache.*;
-import org.jboss.cache.commands.EvictFqnCommand;
+import org.jboss.cache.commands.cachedata.EvictFqnCommand;
import org.jboss.cache.commands.cachedata.*;
import org.jboss.cache.eviction.EvictedEventNode;
import org.jboss.cache.eviction.NodeEventType;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.base.ChainedInterceptor;
import org.jboss.cache.invocation.CacheData;
-import org.apache.commons.logging.LogFactory;
/**
* Eviction Interceptor.
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -27,8 +27,8 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.EvictFqnCommand;
-import org.jboss.cache.commands.InvalidateCommand;
+import org.jboss.cache.commands.cachedata.EvictFqnCommand;
+import org.jboss.cache.commands.cachedata.InvalidateCommand;
import org.jboss.cache.commands.cachedata.*;
import org.jboss.cache.commands.channel.BlockChannelCommand;
import org.jboss.cache.commands.channel.UnblockChannelCommand;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -13,8 +13,8 @@
import org.jboss.cache.cluster.ReplicationQueue;
import org.jboss.cache.commands.CacheCommand;
import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.InvalidateCommand;
-import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.commands.cachedata.InvalidateCommand;
+import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.commands.cachedata.*;
import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
import org.jboss.cache.commands.tx.CommitCommand;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -13,7 +13,7 @@
import org.jboss.cache.NodeFactory;
import org.jboss.cache.NodeNotExistsException;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.commands.cachedata.*;
import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
import org.jboss.cache.config.Configuration;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -11,14 +11,10 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.CacheCommand;
import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.DataVersionCommand;
-import org.jboss.cache.commands.EvictFqnCommand;
-import org.jboss.cache.commands.GravitateDataCommand;
-import org.jboss.cache.commands.cachedata.PutDataMapCommand;
-import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
-import org.jboss.cache.commands.cachedata.RemoveDataCommand;
-import org.jboss.cache.commands.cachedata.RemoveKeyCommand;
-import org.jboss.cache.commands.cachedata.RemoveNodeCommand;
+import org.jboss.cache.commands.state.DataVersionCommand;
+import org.jboss.cache.commands.cachedata.EvictFqnCommand;
+import org.jboss.cache.commands.remote.GravitateDataCommand;
+import org.jboss.cache.commands.cachedata.*;
import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -8,7 +8,7 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.interceptors.base.ChainedInterceptor;
-import org.jboss.cache.commands.EvictFqnCommand;
+import org.jboss.cache.commands.cachedata.EvictFqnCommand;
import org.jboss.cache.loader.CacheLoader;
import java.util.Collections;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -9,7 +9,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.EvictFqnCommand;
+import org.jboss.cache.commands.cachedata.EvictFqnCommand;
import org.jboss.cache.commands.cachedata.*;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -13,8 +13,8 @@
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.commands.CacheCommand;
import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.DataVersionCommand;
-import org.jboss.cache.commands.GlobalTransactionCommand;
+import org.jboss.cache.commands.state.DataVersionCommand;
+import org.jboss.cache.commands.state.GlobalTransactionCommand;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
@@ -31,7 +31,6 @@
import org.jboss.cache.transaction.OptimisticTransactionEntry;
import org.jboss.cache.transaction.TransactionEntry;
import org.jboss.cache.transaction.TxUtil;
-import org.apache.commons.logging.LogFactory;
import javax.transaction.*;
import java.util.HashMap;
@@ -76,7 +75,7 @@
@Inject
- public void intialize(Configuration configuration, CommandsFactory commandsFactory, RPCManager rpcManager,
+ public void intialize(Configuration configuration, RPCManager rpcManager,
CacheTransactionHelper transactionHelper, Notifier notifier, InvocationContextContainer icc,
CacheLifecycleManager lifecycleManager)
{
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -2,9 +2,9 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.cachedata.*;
-import org.jboss.cache.commands.EvictFqnCommand;
-import org.jboss.cache.commands.InvalidateCommand;
-import org.jboss.cache.commands.GravitateDataCommand;
+import org.jboss.cache.commands.cachedata.EvictFqnCommand;
+import org.jboss.cache.commands.cachedata.InvalidateCommand;
+import org.jboss.cache.commands.remote.GravitateDataCommand;
import org.jboss.cache.commands.CacheCommand;
import org.jboss.cache.commands.channel.BlockChannelCommand;
import org.jboss.cache.commands.channel.UnblockChannelCommand;
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -4,7 +4,7 @@
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.buddyreplication.GravitateResult;
import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.GravitateDataCommand;
+import org.jboss.cache.commands.remote.GravitateDataCommand;
import org.jboss.cache.commands.cachedata.*;
import org.jboss.cache.commands.channel.BlockChannelCommand;
import org.jboss.cache.commands.channel.UnblockChannelCommand;
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -12,7 +12,7 @@
import org.jboss.cache.buddyreplication.GravitateResult;
import org.jboss.cache.commands.CacheCommand;
import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.MarshallableCommand;
+import org.jboss.cache.commands.functional.MarshallableCommand;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.optimistic.DefaultDataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/MethodCallWrapper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/MethodCallWrapper.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/MethodCallWrapper.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -1,6 +1,6 @@
package org.jboss.cache.marshall;
-import org.jboss.cache.commands.MarshallableCommand;
+import org.jboss.cache.commands.functional.MarshallableCommand;
/**
* This wrapper class is used when passing in {@link org.jboss.cache.commands.CacheCommand}s into JGroups RPC APIs.
Modified: core/trunk/src/main/java/org/jboss/cache/transaction/TransactionEntry.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/TransactionEntry.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/TransactionEntry.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -12,7 +12,7 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
-import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.commands.cachedata.RemoveNodeCommand;
import org.jboss.cache.config.Option;
import org.jboss.cache.interceptors.OrderedSynchronizationHandler;
Modified: core/trunk/src/main/java/org/jboss/cache/transaction/TransactionTable.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -10,7 +10,7 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
-import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.lock.NodeLock;
import javax.transaction.Transaction;
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -8,7 +8,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.MarshallableCommand;
+import org.jboss.cache.commands.functional.MarshallableCommand;
import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
import org.jboss.cache.commands.remote.ReplicateCommand;
import org.jboss.cache.config.BuddyReplicationConfig;
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -6,7 +6,7 @@
import org.jboss.cache.Region;
import org.jboss.cache.buddyreplication.GravitateResult;
import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.GravitateDataCommand;
+import org.jboss.cache.commands.remote.GravitateDataCommand;
import org.jboss.cache.commands.cachedata.CacheDataCommand;
import org.jboss.cache.commands.remote.ClusteredGetCommand;
import org.jboss.cache.config.Configuration;
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -7,9 +7,8 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.TxCacheCommand;
-import org.jboss.cache.commands.DataVersionCommand;
+import org.jboss.cache.commands.functional.TxCacheCommand;
+import org.jboss.cache.commands.state.DataVersionCommand;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
@@ -20,8 +19,6 @@
import org.jboss.cache.loader.DummySharedInMemoryCacheLoader;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.marshall.MethodCall;
-import org.jboss.cache.marshall.MethodCallFactory;
-import org.jboss.cache.marshall.MethodDeclarations;
import org.jboss.cache.misc.TestingUtil;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.cache.transaction.TransactionSetup;
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -11,8 +11,8 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.VersionedNode;
import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.GlobalTransactionCommand;
-import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.commands.state.GlobalTransactionCommand;
+import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.invocation.NodeInvocationDelegate;
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -8,7 +8,7 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.commands.CacheCommand;
-import org.jboss.cache.commands.GlobalTransactionCommand;
+import org.jboss.cache.commands.state.GlobalTransactionCommand;
import org.jboss.cache.commands.CommandsFactory;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.loader.SamplePojo;
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java 2008-04-14 12:26:47 UTC (rev 5547)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java 2008-04-14 13:22:50 UTC (rev 5548)
@@ -8,7 +8,7 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.GlobalTransactionCommand;
+import org.jboss.cache.commands.state.GlobalTransactionCommand;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
16 years, 2 months
JBoss Cache SVN: r5547 - core/trunk/src/main/java/org/jboss/cache/commands.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-04-14 08:26:47 -0400 (Mon, 14 Apr 2008)
New Revision: 5547
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/BaseCacheCommand.java
Log:
Added CacheInjectionMethods annotation
Modified: core/trunk/src/main/java/org/jboss/cache/commands/BaseCacheCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/BaseCacheCommand.java 2008-04-13 01:24:05 UTC (rev 5546)
+++ core/trunk/src/main/java/org/jboss/cache/commands/BaseCacheCommand.java 2008-04-14 12:26:47 UTC (rev 5547)
@@ -4,6 +4,7 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.annotations.CacheInjectionMethods;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.notifications.Notifier;
@@ -12,6 +13,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
+@CacheInjectionMethods
public abstract class BaseCacheCommand implements MarshallableCommand
{
protected static final Object[] EMPTY_OBJECT_ARRAY = new Object[]{};
16 years, 2 months
JBoss Cache SVN: r5546 - in core/trunk/src: main/java/org/jboss/cache/commands/cachedata and 2 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-04-12 21:24:05 -0400 (Sat, 12 Apr 2008)
New Revision: 5546
Modified:
core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java
core/trunk/src/main/java/org/jboss/cache/invocation/CacheLifecycleManager.java
core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java
Log:
* @Inject methods cannot contain primitives
* CacheLifeCycleManager.internalStart() to remove InterceptorChain from component registry for reqiring before starting
*
Modified: core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2008-04-12 23:12:51 UTC (rev 5545)
+++ core/trunk/src/main/java/org/jboss/cache/DefaultCacheFactory.java 2008-04-13 01:24:05 UTC (rev 5546)
@@ -133,7 +133,7 @@
this.configuration = configuration;
// make sure we set the CacheLifecycleManager and CacheSPI instance in the component registry.
- componentRegistry.registerComponent(lifecycleManager, CacheLifecycleManager.class);
+ componentRegistry.registerComponent(CacheLifecycleManager.class.getName(), lifecycleManager, CacheLifecycleManager.class);
componentRegistry.registerComponent(CacheSPI.class.getName(), spi, CacheSPI.class);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java 2008-04-12 23:12:51 UTC (rev 5545)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java 2008-04-13 01:24:05 UTC (rev 5546)
@@ -10,6 +10,7 @@
import org.jboss.cache.commands.DataVersionCommand;
import org.jboss.cache.commands.GlobalTransactionCommand;
import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.notifications.Notifier;
@@ -62,12 +63,12 @@
}
@Inject
- public void initialize(CacheData cacheData, TransactionTable txTable, Notifier notifier, boolean isOptimisticLocking)
+ public void initialize(CacheData cacheData, TransactionTable txTable, Notifier notifier, Configuration configuration)
{
this.cacheData = cacheData;
this.transactionTable = txTable;
this.notifier = notifier;
- this.isOptimistic = isOptimisticLocking;
+ this.isOptimistic = configuration.isNodeLockingOptimistic();
}
public Object perform(InvocationContext ctx)
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheLifecycleManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheLifecycleManager.java 2008-04-12 23:12:51 UTC (rev 5545)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheLifecycleManager.java 2008-04-13 01:24:05 UTC (rev 5546)
@@ -13,7 +13,6 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.interceptors.base.ChainedInterceptor;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.lock.LockStrategyFactory;
import org.jboss.cache.marshall.Marshaller;
@@ -372,7 +371,8 @@
private void removeConfigurationDependentComponents()
{
// remove the Interceptor.class component though, since it may pertain to an old config
- componentRegistry.unregisterComponent(ChainedInterceptor.class);
+
+ componentRegistry.unregisterComponent(InterceptorChain.class); // the interceptor chain will need reconstructing in case the cfg has changed before calling start()
componentRegistry.unregisterComponent(Marshaller.class);
componentRegistry.unregisterComponent(TransactionManager.class);
componentRegistry.unregisterComponent(BuddyManager.class);
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java 2008-04-12 23:12:51 UTC (rev 5545)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java 2008-04-13 01:24:05 UTC (rev 5546)
@@ -142,7 +142,7 @@
{
Integer age;
Listener lis = new Listener();
- cache1.getNotifier().addCacheListener(lis);
+ cache1.addCacheListener(lis);
lis.put("/a/b/c", "age", 38);
// value on cache2 must be 38
16 years, 2 months
JBoss Cache SVN: r5545 - in core/trunk/src/main/java/org/jboss/cache: commands/cachedata and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-04-12 19:12:51 -0400 (Sat, 12 Apr 2008)
New Revision: 5545
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
Log:
Added pFER support
Modified: core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java 2008-04-12 23:01:09 UTC (rev 5544)
+++ core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java 2008-04-12 23:12:51 UTC (rev 5545)
@@ -1,11 +1,9 @@
package org.jboss.cache.commands;
import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.RPCManager;
import org.jboss.cache.buddyreplication.BuddyGroup;
-import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.commands.cachedata.*;
import org.jboss.cache.commands.channel.BlockChannelCommand;
import org.jboss.cache.commands.channel.UnblockChannelCommand;
@@ -19,18 +17,11 @@
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
-import org.jboss.cache.invocation.CacheTransactionHelper;
-import org.jboss.cache.invocation.InterceptorChain;
-import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.TransactionTable;
import org.jgroups.Address;
-import javax.transaction.TransactionManager;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -49,40 +40,19 @@
*/
public class CommandsFactory
{
- private Notifier notifier;
- private TransactionTable transactionTable;
- private CacheData cacheData;
- private CacheSPI spi;
- private Configuration configuration;
- private TransactionManager tm;
private RPCManager rpcManager;
- private CacheTransactionHelper transactionHelper;
- private BuddyManager buddyManager;
- private InterceptorChain interceptorChain;
private ComponentRegistry registry;
@Inject
- public void initialize(Notifier notifier, TransactionTable transactionTable, CacheData cacheData, CacheSPI spi,
- Configuration configuration, TransactionManager txm, RPCManager rpc, CacheTransactionHelper txHelper,
- BuddyManager buddyManager, InterceptorChain interceptorChain, ComponentRegistry registry)
+ public void initialize(RPCManager rpc, ComponentRegistry registry)
{
- this.notifier = notifier;
- this.transactionTable = transactionTable;
- this.cacheData = cacheData;
- this.spi = spi;
- this.configuration = configuration;
- this.tm = txm;
this.rpcManager = rpc;
- this.transactionHelper = txHelper;
- this.buddyManager = buddyManager;
- this.interceptorChain = interceptorChain;
this.registry = registry;
}
public PutDataMapCommand buildPutDataMapCommand(GlobalTransaction gtx, Fqn fqn, Map data, boolean createUndoOps, boolean eraseContents)
{
PutDataMapCommand cmd = new PutDataMapCommand(gtx, fqn, data, createUndoOps, eraseContents);
- //putDataMapCommand.initialize(cacheData, notifier, transactionTable);
registry.wireDependencies(cmd);
return cmd;
}
@@ -90,7 +60,6 @@
public PutKeyValueCommand buildPutKeyValueCommand(GlobalTransaction gtx, Fqn fqn, Object key, Object value, boolean createUndoOps, boolean putForExternalRead)
{
PutKeyValueCommand command = new PutKeyValueCommand(gtx, fqn, key, value, createUndoOps, putForExternalRead);
- //command.initialize(cacheData, notifier, transactionTable);
registry.wireDependencies(command);
return command;
}
@@ -131,7 +100,6 @@
public DataGravitationCleanupCommand buildDataGravitationCleanupCommand(Fqn primaryFqn, Fqn backupFqn)
{
DataGravitationCleanupCommand command = new DataGravitationCleanupCommand(primaryFqn, backupFqn);
- //command.initialize(buddyManager, interceptorChain, transactionHelper, this, cacheData);
registry.wireDependencies(command);
return command;
}
@@ -139,7 +107,6 @@
public GravitateDataCommand buildGravitateDataCommand(Fqn fqn, Boolean searchSubtrees)
{
GravitateDataCommand command = new GravitateDataCommand(fqn, searchSubtrees);
- //command.initialize(spi, rpcManager, cacheData);
registry.wireDependencies(command);
return command;
}
@@ -147,7 +114,6 @@
public RemoveNodeCommand buildRemoveNodeCommand(GlobalTransaction gtx, Fqn fqn, boolean eviction, boolean skipSendingNodeEvents, boolean createUndoOps)
{
RemoveNodeCommand command = new RemoveNodeCommand(gtx, fqn, createUndoOps, skipSendingNodeEvents, eviction);
-// command.initialize(cacheData, transactionTable, notifier, configuration.isNodeLockingOptimistic());
registry.wireDependencies(command);
return command;
}
@@ -155,7 +121,6 @@
public RemoveDataCommand buildRemoveDataCommand(GlobalTransaction gtx, Fqn fqn, boolean createUndoops, boolean sendNodeEvent, boolean eviction)
{
RemoveDataCommand command = new RemoveDataCommand(gtx, fqn, createUndoops, sendNodeEvent, eviction);
-// command.initialize(cacheData, transactionTable, notifier);
registry.wireDependencies(command);
return command;
}
@@ -163,7 +128,6 @@
public EvictFqnCommand buildEvictFqnCommand(Fqn fqn)
{
EvictFqnCommand command = new EvictFqnCommand(fqn);
-// command.initialize(cacheData);
registry.wireDependencies(command);
return command;
}
@@ -171,7 +135,6 @@
public InvalidateCommand buildInvalidateCommand(Fqn fqn)
{
InvalidateCommand command = new InvalidateCommand(fqn);
-// command.initialize(cacheData, notifier, spi, tm, configuration.isNodeLockingOptimistic());
registry.wireDependencies(command);
return command;
}
@@ -179,7 +142,6 @@
public RemoveKeyCommand buildRemoveKeyCommand(GlobalTransaction tx, Fqn<?> fqn, Object key, boolean b)
{
RemoveKeyCommand command = new RemoveKeyCommand(tx, fqn, key, b);
-// command.initialize(cacheData, notifier, transactionTable);
registry.wireDependencies(command);
return command;
}
@@ -187,7 +149,6 @@
public GetDataMapCommand buildGetDataMapCommand(Fqn fqn)
{
GetDataMapCommand command = new GetDataMapCommand(fqn);
- //command.initialize(cacheData);
registry.wireDependencies(command);
return command;
}
@@ -195,7 +156,6 @@
public ExistsNodeCommand buildExistsNodeCommand(Fqn fqn)
{
ExistsNodeCommand command = new ExistsNodeCommand(fqn);
-// command.initialize(cacheData);
registry.wireDependencies(command);
return command;
}
@@ -203,7 +163,6 @@
public GetKeyValueCommand buildGetKeyValueCommand(Fqn<?> fqn, Object key, boolean sendNodeEvent)
{
GetKeyValueCommand command = new GetKeyValueCommand(fqn, key, sendNodeEvent);
-// command.initialize(cacheData, notifier);
registry.wireDependencies(command);
return command;
}
@@ -211,7 +170,6 @@
public GetNodeCommand buildGetNodeCommand(Fqn fqn)
{
GetNodeCommand command = new GetNodeCommand(fqn);
-// command.initialize(cacheData);
registry.wireDependencies(command);
return command;
}
@@ -219,7 +177,6 @@
public GetKeysCommand buildGetKeysCommand(Fqn fqn)
{
GetKeysCommand command = new GetKeysCommand(fqn);
-// command.initialize(cacheData);
registry.wireDependencies(command);
return command;
}
@@ -227,7 +184,6 @@
public GetChildrenNamesCommand buildGetChildrenNamesCommand(Fqn fqn)
{
GetChildrenNamesCommand command = new GetChildrenNamesCommand(fqn);
-// command.initialize(cacheData);
registry.wireDependencies(command);
return command;
}
@@ -235,7 +191,6 @@
public MoveCommand buildMoveCommand(Fqn from, Fqn to)
{
MoveCommand command = new MoveCommand(from, to);
-// command.initialize(cacheData, notifier, transactionTable);
registry.wireDependencies(command);
return command;
}
@@ -243,7 +198,6 @@
public GravitateDataCommand buildGravitateDataCacheCommand(Fqn fqn, boolean searchSubtrees)
{
GravitateDataCommand command = new GravitateDataCommand(fqn, searchSubtrees);
-// command.initialize(spi, rpcManager, cacheData);
registry.wireDependencies(command);
return command;
}
@@ -271,7 +225,6 @@
public AnnounceBuddyPoolNameCommand buildAnnounceBuddyPoolNameCommand(Address address, String buddyPoolName)
{
AnnounceBuddyPoolNameCommand command = new AnnounceBuddyPoolNameCommand(address, buddyPoolName);
-// command.initialize(buddyManager);
registry.wireDependencies(command);
return command;
}
@@ -279,7 +232,6 @@
public RemoveFromBuddyGroupCommand buildRemoveFromBuddyGroupCommand(String groupName)
{
RemoveFromBuddyGroupCommand command = new RemoveFromBuddyGroupCommand(groupName);
-// command.initialize(buddyManager);
registry.wireDependencies(command);
return command;
}
@@ -287,7 +239,6 @@
public AssignToBuddyGroupCommand buildAssignToBuddyGroupCommand(BuddyGroup group, Map<Fqn, byte[]> state)
{
AssignToBuddyGroupCommand command = new AssignToBuddyGroupCommand(group, state);
-// command.initialize(buddyManager);
registry.wireDependencies(command);
return command;
}
@@ -360,6 +311,9 @@
break;
case PutKeyValueCommand.METHOD_ID:
+ case PutKeyValueCommand.VERSIONED_METHOD_ID:
+ case PutKeyValueCommand.PUT_FOR_EXT_READ_METHOD_ID:
+ case PutKeyValueCommand.PUT_FOR_EXT_READ_VERSIONED_METHOD_ID:
returnValue = new PutKeyValueCommand();
break;
@@ -407,12 +361,4 @@
registry.wireDependencies(returnValue);
return returnValue;
}
-
-// private List<CacheCommand> toCacheCommandList(List<MethodCall> calls)
-// {
-// if (calls == null) return null;
-// List<CacheCommand> ccList = new ArrayList<CacheCommand>(calls.size());
-// for (MethodCall mc : calls) ccList.add(fromStream(mc.getMethodId(), mc.getArgs()));
-// return ccList;
-// }
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java 2008-04-12 23:12:51 UTC (rev 5545)
@@ -30,6 +30,9 @@
public class PutKeyValueCommand extends BaseCacheCommand implements TxCacheCommand, CacheDataCommand, DataVersionCommand, GlobalTransactionCommand
{
public static final int METHOD_ID = 3;
+ public static final int VERSIONED_METHOD_ID = 39;
+ public static final int PUT_FOR_EXT_READ_METHOD_ID = 45;
+ public static final int PUT_FOR_EXT_READ_VERSIONED_METHOD_ID = 46;
private static final Log log = LogFactory.getLog(PutKeyValueCommand.class);
@@ -181,12 +184,22 @@
public int getCommandId()
{
- return METHOD_ID;
+ if (isVersioned())
+ {
+ return isPutForExternalRead ? PUT_FOR_EXT_READ_VERSIONED_METHOD_ID : VERSIONED_METHOD_ID;
+ }
+ else
+ {
+ return isPutForExternalRead ? PUT_FOR_EXT_READ_METHOD_ID : METHOD_ID;
+ }
}
public Object[] getParameters()
{
- return new Object[]{globalTransaction, fqn, key, value, createUndoOps};
+ if (isVersioned())
+ return new Object[]{globalTransaction, fqn, key, value, createUndoOps, dataVersion};
+ else
+ return new Object[]{globalTransaction, fqn, key, value, createUndoOps};
}
public void setState(int commandId, Object[] args)
@@ -196,5 +209,8 @@
key = args[2];
value = args[3];
createUndoOps = (Boolean) args[4];
+ isPutForExternalRead = (commandId == PUT_FOR_EXT_READ_METHOD_ID || commandId == PUT_FOR_EXT_READ_VERSIONED_METHOD_ID);
+ if (commandId == PUT_FOR_EXT_READ_VERSIONED_METHOD_ID || commandId == VERSIONED_METHOD_ID)
+ dataVersion = (DataVersion) args[5];
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-04-12 23:01:09 UTC (rev 5544)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-04-12 23:12:51 UTC (rev 5545)
@@ -452,7 +452,7 @@
{
getInvocationContext().getOptionOverrides().setFailSilently(true);
getInvocationContext().getOptionOverrides().setForceAsynchronous(true);
- PutKeyValueCommand command = commandsFactory.buildPutKeyValueCommand(null, fqn, key, value, false, false);
+ PutKeyValueCommand command = commandsFactory.buildPutKeyValueCommand(null, fqn, key, value, false, true);
invoke(command);
}
else
16 years, 2 months
JBoss Cache SVN: r5544 - in core/trunk/src/main/java/org/jboss/cache: commands/cachedata and 3 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-04-12 19:01:09 -0400 (Sat, 12 Apr 2008)
New Revision: 5544
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/BaseCacheCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java
core/trunk/src/main/java/org/jboss/cache/commands/EvictFqnCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/GravitateDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/InvalidateCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/ExistsNodeCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetChildrenNamesCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetDataMapCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeyValueCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeysCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetNodeCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/MoveCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveKeyCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/trunk/src/main/java/org/jboss/cache/invocation/InterceptorChain.java
core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java
core/trunk/src/main/java/org/jboss/cache/marshall/InactiveRegionAwareRpcDispatcher.java
core/trunk/src/main/java/org/jboss/cache/marshall/RegionalizedMethodCall.java
Log:
Updates to commands
Modified: core/trunk/src/main/java/org/jboss/cache/commands/BaseCacheCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/BaseCacheCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/BaseCacheCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -4,6 +4,7 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.notifications.Notifier;
@@ -19,13 +20,16 @@
protected CacheData cacheData;
protected CacheSPI spi;
protected Configuration configuration;
+ protected static boolean trace;
+ @Inject
public void init(Notifier notifier, CacheData cacheData, CacheSPI spi, Configuration configuration)
{
this.notifier = notifier;
this.cacheData = cacheData;
this.spi = spi;
this.configuration = configuration;
+ trace = log.isTraceEnabled();
}
public Notifier getNotifier()
Modified: core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/CommandsFactory.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -20,18 +20,18 @@
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.invocation.CacheTransactionHelper;
import org.jboss.cache.invocation.InterceptorChain;
-import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
import org.jgroups.Address;
import javax.transaction.TransactionManager;
-import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -59,11 +59,12 @@
private CacheTransactionHelper transactionHelper;
private BuddyManager buddyManager;
private InterceptorChain interceptorChain;
+ private ComponentRegistry registry;
@Inject
public void initialize(Notifier notifier, TransactionTable transactionTable, CacheData cacheData, CacheSPI spi,
Configuration configuration, TransactionManager txm, RPCManager rpc, CacheTransactionHelper txHelper,
- BuddyManager buddyManager, InterceptorChain interceptorChain)
+ BuddyManager buddyManager, InterceptorChain interceptorChain, ComponentRegistry registry)
{
this.notifier = notifier;
this.transactionTable = transactionTable;
@@ -75,208 +76,241 @@
this.transactionHelper = txHelper;
this.buddyManager = buddyManager;
this.interceptorChain = interceptorChain;
+ this.registry = registry;
}
public PutDataMapCommand buildPutDataMapCommand(GlobalTransaction gtx, Fqn fqn, Map data, boolean createUndoOps, boolean eraseContents)
{
- PutDataMapCommand putDataMapCommand = new PutDataMapCommand(gtx, fqn, data, createUndoOps, eraseContents);
- putDataMapCommand.initialize(cacheData, notifier, transactionTable);
- return putDataMapCommand;
+ PutDataMapCommand cmd = new PutDataMapCommand(gtx, fqn, data, createUndoOps, eraseContents);
+ //putDataMapCommand.initialize(cacheData, notifier, transactionTable);
+ registry.wireDependencies(cmd);
+ return cmd;
}
public PutKeyValueCommand buildPutKeyValueCommand(GlobalTransaction gtx, Fqn fqn, Object key, Object value, boolean createUndoOps, boolean putForExternalRead)
{
PutKeyValueCommand command = new PutKeyValueCommand(gtx, fqn, key, value, createUndoOps, putForExternalRead);
- command.initialize(cacheData, notifier, transactionTable);
+ //command.initialize(cacheData, notifier, transactionTable);
+ registry.wireDependencies(command);
return command;
}
-
public ReplicateCommand buildReplicateCommand(MarshallableCommand command)
{
- return new ReplicateCommand(command);
+ ReplicateCommand cmd = new ReplicateCommand(command);
+ registry.wireDependencies(cmd);
+ return cmd;
}
public ReplicateCommand buildReplicateCommand(List<MarshallableCommand> modifications)
{
- return new ReplicateCommand(modifications);
+ ReplicateCommand cmd = new ReplicateCommand(modifications);
+ registry.wireDependencies(cmd);
+ return cmd;
}
public PrepareCommand buildPrepareCommand(GlobalTransaction gtx, CacheCommand command, boolean onePhaseCommit)
{
- Address localAddress = rpcManager.getLocalAddress();
- List<CacheCommand> modList = new ArrayList<CacheCommand>(1);
- modList.add(command);
- return buildPrepareCommand(gtx, modList, localAddress, onePhaseCommit);
+ return buildPrepareCommand(gtx, Collections.singletonList(command), rpcManager.getLocalAddress(), onePhaseCommit);
}
public PrepareCommand buildPrepareCommand(GlobalTransaction gtx, List<? extends CacheCommand> modifications, Address address, boolean onePhaseCommit)
{
- return new PrepareCommand(gtx, modifications, address, onePhaseCommit);
+ PrepareCommand cmd = new PrepareCommand(gtx, modifications, address, onePhaseCommit);
+ registry.wireDependencies(cmd);
+ return cmd;
}
public CommitCommand buildCommitCommand(GlobalTransaction gtx)
{
- return new CommitCommand(gtx);
+ CommitCommand cmd = new CommitCommand(gtx);
+ registry.wireDependencies(cmd);
+ return cmd;
}
public DataGravitationCleanupCommand buildDataGravitationCleanupCommand(Fqn primaryFqn, Fqn backupFqn)
{
DataGravitationCleanupCommand command = new DataGravitationCleanupCommand(primaryFqn, backupFqn);
- command.initialize(buddyManager, interceptorChain, transactionHelper, this, cacheData);
+ //command.initialize(buddyManager, interceptorChain, transactionHelper, this, cacheData);
+ registry.wireDependencies(command);
return command;
}
public GravitateDataCommand buildGravitateDataCommand(Fqn fqn, Boolean searchSubtrees)
{
GravitateDataCommand command = new GravitateDataCommand(fqn, searchSubtrees);
- command.initialize(spi, rpcManager, cacheData);
+ //command.initialize(spi, rpcManager, cacheData);
+ registry.wireDependencies(command);
return command;
}
public RemoveNodeCommand buildRemoveNodeCommand(GlobalTransaction gtx, Fqn fqn, boolean eviction, boolean skipSendingNodeEvents, boolean createUndoOps)
{
RemoveNodeCommand command = new RemoveNodeCommand(gtx, fqn, createUndoOps, skipSendingNodeEvents, eviction);
- command.initialize(cacheData, transactionTable, notifier, configuration.isNodeLockingOptimistic());
+// command.initialize(cacheData, transactionTable, notifier, configuration.isNodeLockingOptimistic());
+ registry.wireDependencies(command);
return command;
}
public RemoveDataCommand buildRemoveDataCommand(GlobalTransaction gtx, Fqn fqn, boolean createUndoops, boolean sendNodeEvent, boolean eviction)
{
RemoveDataCommand command = new RemoveDataCommand(gtx, fqn, createUndoops, sendNodeEvent, eviction);
- command.initialize(cacheData, transactionTable, notifier);
+// command.initialize(cacheData, transactionTable, notifier);
+ registry.wireDependencies(command);
return command;
}
public EvictFqnCommand buildEvictFqnCommand(Fqn fqn)
{
EvictFqnCommand command = new EvictFqnCommand(fqn);
- command.initialize(cacheData);
+// command.initialize(cacheData);
+ registry.wireDependencies(command);
return command;
}
public InvalidateCommand buildInvalidateCommand(Fqn fqn)
{
InvalidateCommand command = new InvalidateCommand(fqn);
- command.initialize(cacheData, notifier, spi, tm, configuration.isNodeLockingOptimistic());
+// command.initialize(cacheData, notifier, spi, tm, configuration.isNodeLockingOptimistic());
+ registry.wireDependencies(command);
return command;
}
public RemoveKeyCommand buildRemoveKeyCommand(GlobalTransaction tx, Fqn<?> fqn, Object key, boolean b)
{
RemoveKeyCommand command = new RemoveKeyCommand(tx, fqn, key, b);
- command.initialize(cacheData, notifier, transactionTable);
+// command.initialize(cacheData, notifier, transactionTable);
+ registry.wireDependencies(command);
return command;
}
public GetDataMapCommand buildGetDataMapCommand(Fqn fqn)
{
GetDataMapCommand command = new GetDataMapCommand(fqn);
- command.initialize(cacheData);
+ //command.initialize(cacheData);
+ registry.wireDependencies(command);
return command;
}
public ExistsNodeCommand buildExistsNodeCommand(Fqn fqn)
{
ExistsNodeCommand command = new ExistsNodeCommand(fqn);
- command.initialize(cacheData);
+// command.initialize(cacheData);
+ registry.wireDependencies(command);
return command;
}
public GetKeyValueCommand buildGetKeyValueCommand(Fqn<?> fqn, Object key, boolean sendNodeEvent)
{
GetKeyValueCommand command = new GetKeyValueCommand(fqn, key, sendNodeEvent);
- command.initialize(cacheData, notifier);
+// command.initialize(cacheData, notifier);
+ registry.wireDependencies(command);
return command;
}
public GetNodeCommand buildGetNodeCommand(Fqn fqn)
{
GetNodeCommand command = new GetNodeCommand(fqn);
- command.initialize(cacheData);
+// command.initialize(cacheData);
+ registry.wireDependencies(command);
return command;
}
public GetKeysCommand buildGetKeysCommand(Fqn fqn)
{
GetKeysCommand command = new GetKeysCommand(fqn);
- command.initialize(cacheData);
+// command.initialize(cacheData);
+ registry.wireDependencies(command);
return command;
}
public GetChildrenNamesCommand buildGetChildrenNamesCommand(Fqn fqn)
{
GetChildrenNamesCommand command = new GetChildrenNamesCommand(fqn);
- command.initialize(cacheData);
+// command.initialize(cacheData);
+ registry.wireDependencies(command);
return command;
}
public MoveCommand buildMoveCommand(Fqn from, Fqn to)
{
MoveCommand command = new MoveCommand(from, to);
- command.initialize(cacheData, notifier, transactionTable);
+// command.initialize(cacheData, notifier, transactionTable);
+ registry.wireDependencies(command);
return command;
}
public GravitateDataCommand buildGravitateDataCacheCommand(Fqn fqn, boolean searchSubtrees)
{
GravitateDataCommand command = new GravitateDataCommand(fqn, searchSubtrees);
- command.initialize(spi, rpcManager, cacheData);
+// command.initialize(spi, rpcManager, cacheData);
+ registry.wireDependencies(command);
return command;
}
public RollbackCommand buildRollbackCommand(GlobalTransaction gtx)
{
- return new RollbackCommand(gtx);
+ RollbackCommand cmd = new RollbackCommand(gtx);
+ registry.wireDependencies(cmd);
+ return cmd;
}
public OptimisticPrepareCommand buildOptimisticPrepareCommand(GlobalTransaction gtx, List<? extends CacheCommand> modifications, Map data, Address address, boolean onePhaseCommit)
{
- return new OptimisticPrepareCommand(gtx, modifications, data, address, onePhaseCommit);
+ OptimisticPrepareCommand cmd = new OptimisticPrepareCommand(gtx, modifications, data, address, onePhaseCommit);
+ registry.wireDependencies(cmd);
+ return cmd;
}
public OptimisticPrepareCommand buildOptimisticPrepareCommand(GlobalTransaction gtx, CacheCommand command)
{
- List<CacheCommand> commandList = new ArrayList<CacheCommand>(1);
- commandList.add(command);
- return buildOptimisticPrepareCommand(gtx, commandList, null, null, false);
+ return buildOptimisticPrepareCommand(gtx, Collections.singletonList(command), null, null, false);
}
public AnnounceBuddyPoolNameCommand buildAnnounceBuddyPoolNameCommand(Address address, String buddyPoolName)
{
AnnounceBuddyPoolNameCommand command = new AnnounceBuddyPoolNameCommand(address, buddyPoolName);
- command.initialize(buddyManager);
+// command.initialize(buddyManager);
+ registry.wireDependencies(command);
return command;
}
public RemoveFromBuddyGroupCommand buildRemoveFromBuddyGroupCommand(String groupName)
{
RemoveFromBuddyGroupCommand command = new RemoveFromBuddyGroupCommand(groupName);
- command.initialize(buddyManager);
+// command.initialize(buddyManager);
+ registry.wireDependencies(command);
return command;
}
public AssignToBuddyGroupCommand buildAssignToBuddyGroupCommand(BuddyGroup group, Map<Fqn, byte[]> state)
{
AssignToBuddyGroupCommand command = new AssignToBuddyGroupCommand(group, state);
- command.initialize(buddyManager);
+// command.initialize(buddyManager);
+ registry.wireDependencies(command);
return command;
}
public ClusteredGetCommand buildClusteredGetCommand(Boolean searchBackupSubtrees, CacheDataCommand cacheDataComand)
{
- return new ClusteredGetCommand(searchBackupSubtrees, cacheDataComand);
+ ClusteredGetCommand command = new ClusteredGetCommand(searchBackupSubtrees, cacheDataComand);
+ registry.wireDependencies(command);
+ return command;
}
public BlockChannelCommand buildBlockChannelCommand()
{
- return new BlockChannelCommand();
+ BlockChannelCommand command = new BlockChannelCommand();
+ registry.wireDependencies(command);
+ return command;
}
public UnblockChannelCommand buildUnblockChannelCommand()
{
- return new UnblockChannelCommand();
+ UnblockChannelCommand command = new UnblockChannelCommand();
+ registry.wireDependencies(command);
+ return command;
}
/**
@@ -370,14 +404,15 @@
}
returnValue.setState(id, parameters);
+ registry.wireDependencies(returnValue);
return returnValue;
}
- private List<CacheCommand> toCacheCommandList(List<MethodCall> calls)
- {
- if (calls == null) return null;
- List<CacheCommand> ccList = new ArrayList<CacheCommand>(calls.size());
- for (MethodCall mc : calls) ccList.add(fromStream(mc.getMethodId(), mc.getArgs()));
- return ccList;
- }
+// private List<CacheCommand> toCacheCommandList(List<MethodCall> calls)
+// {
+// if (calls == null) return null;
+// List<CacheCommand> ccList = new ArrayList<CacheCommand>(calls.size());
+// for (MethodCall mc : calls) ccList.add(fromStream(mc.getMethodId(), mc.getArgs()));
+// return ccList;
+// }
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/EvictFqnCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/EvictFqnCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/EvictFqnCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -2,6 +2,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.optimistic.DataVersion;
@@ -28,6 +29,7 @@
this.fqn = fqn;
}
+ @Inject
public void initialize(CacheData cacheData)
{
this.cacheData = cacheData;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/GravitateDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/GravitateDataCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/GravitateDataCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -11,6 +11,7 @@
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.buddyreplication.GravitateResult;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.marshall.NodeData;
@@ -45,11 +46,12 @@
this.searchSubtrees = searchSubtrees;
}
+ @Inject
public void initialize(CacheSPI spi, RPCManager manager, CacheData cacheData)
{
this.spi = spi;
this.rpcManager = manager;
- rpcManager = manager;
+ this.cacheData = cacheData;
}
public Object perform(InvocationContext ctx)
Modified: core/trunk/src/main/java/org/jboss/cache/commands/InvalidateCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/InvalidateCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/InvalidateCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -2,8 +2,14 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.*;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.Node;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.config.Option;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.notifications.Notifier;
@@ -42,6 +48,7 @@
super(fqn);
}
+ @Inject
public void initialize(CacheData cacheData, Notifier notifier, CacheSPI cacheSPI, TransactionManager txManager, boolean isOptimisticLocking)
{
super.initialize(cacheData);
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/ExistsNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/ExistsNodeCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/ExistsNodeCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -5,6 +5,7 @@
import org.jboss.cache.Node;
import org.jboss.cache.commands.BaseCacheCommand;
import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
/**
@@ -33,6 +34,7 @@
this.fqn = fqn;
}
+ @Inject
public void initialize(CacheData cacheData)
{
this.cacheData = cacheData;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetChildrenNamesCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetChildrenNamesCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetChildrenNamesCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -5,6 +5,7 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.BaseCacheCommand;
import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import java.util.Collection;
@@ -34,6 +35,7 @@
this.fqn = fqn;
}
+ @Inject
public void initialize(CacheData cacheData)
{
this.cacheData = cacheData;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetDataMapCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetDataMapCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetDataMapCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -5,6 +5,7 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.BaseCacheCommand;
import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
/**
@@ -30,6 +31,7 @@
this.fqn = fqn;
}
+ @Inject
public void initialize(CacheData cacheData)
{
this.cacheData = cacheData;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeyValueCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeyValueCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeyValueCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -7,6 +7,7 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.BaseCacheCommand;
import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.notifications.Notifier;
@@ -42,6 +43,7 @@
this.sendNodeEvent = sendNodeEvent;
}
+ @Inject
public void initialize(CacheData cacheData, Notifier notifier)
{
this.cacheData = cacheData;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeysCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeysCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeysCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -5,6 +5,7 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.BaseCacheCommand;
import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import java.util.HashSet;
@@ -33,6 +34,7 @@
this.fqn = fqn;
}
+ @Inject
public void initialize(CacheData cacheData)
{
this.cacheData = cacheData;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetNodeCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetNodeCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -4,6 +4,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.BaseCacheCommand;
import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
/**
@@ -29,6 +30,7 @@
this.fqn = fqn;
}
+ @Inject
public void initialize(CacheData cacheData)
{
this.cacheData = cacheData;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/MoveCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/MoveCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/MoveCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -7,6 +7,7 @@
import org.jboss.cache.commands.BaseCacheCommand;
import org.jboss.cache.commands.CacheCommandsVisitor;
import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.transaction.TransactionTable;
@@ -40,6 +41,7 @@
this.to = to;
}
+ @Inject
public void initialize(CacheData cacheData, Notifier notifier, TransactionTable txTable)
{
this.cacheData = cacheData;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -10,6 +10,7 @@
import org.jboss.cache.commands.DataVersionCommand;
import org.jboss.cache.commands.GlobalTransactionCommand;
import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
@@ -63,6 +64,7 @@
this.eraseContents = eraseContents;
}
+ @Inject
public void initialize(CacheData cacheData, Notifier notifier, TransactionTable txTable)
{
this.cacheData = cacheData;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -10,6 +10,7 @@
import org.jboss.cache.commands.DataVersionCommand;
import org.jboss.cache.commands.GlobalTransactionCommand;
import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
@@ -65,6 +66,7 @@
this.isPutForExternalRead = isPutForExternalRead;
}
+ @Inject
public void initialize(CacheData cacheData, Notifier notifier, TransactionTable transactionTable)
{
this.transactionTable = transactionTable;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveDataCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveDataCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -10,6 +10,7 @@
import org.jboss.cache.commands.DataVersionCommand;
import org.jboss.cache.commands.GlobalTransactionCommand;
import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
@@ -55,6 +56,7 @@
{
}
+ @Inject
public void initialize(CacheData cacheData, TransactionTable transactionTable, Notifier notifier)
{
this.cacheData = cacheData;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveKeyCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveKeyCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveKeyCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -10,6 +10,7 @@
import org.jboss.cache.commands.DataVersionCommand;
import org.jboss.cache.commands.GlobalTransactionCommand;
import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
@@ -62,6 +63,7 @@
this.createUndoOps = createUndoOps;
}
+ @Inject
public void initialize(CacheData cacheData, Notifier notifier, TransactionTable transactionTable)
{
this.cacheData = cacheData;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -10,6 +10,7 @@
import org.jboss.cache.commands.DataVersionCommand;
import org.jboss.cache.commands.GlobalTransactionCommand;
import org.jboss.cache.commands.TxCacheCommand;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.optimistic.DataVersion;
@@ -60,6 +61,7 @@
this.eviction = eviction;
}
+ @Inject
public void initialize(CacheData cacheData, TransactionTable txTable, Notifier notifier, boolean isOptimisticLocking)
{
this.cacheData = cacheData;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -7,6 +7,7 @@
import org.jboss.cache.commands.BaseCacheCommand;
import org.jboss.cache.commands.CacheCommand;
import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.factories.annotations.Inject;
import org.jgroups.Address;
/**
@@ -35,6 +36,7 @@
this.buddyPoolName = buddyPoolName;
}
+ @Inject
public void initialize(BuddyManager buddyManager)
{
this.buddyManager = buddyManager;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -9,6 +9,7 @@
import org.jboss.cache.commands.BaseCacheCommand;
import org.jboss.cache.commands.CacheCommand;
import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.factories.annotations.Inject;
import java.util.Map;
@@ -37,6 +38,7 @@
this.state = state;
}
+ @Inject
public void initialize(BuddyManager manager)
{
this.buddyManager = manager;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -13,6 +13,7 @@
import org.jboss.cache.commands.GlobalTransactionCommand;
import org.jboss.cache.commands.TxCacheCommand;
import org.jboss.cache.commands.cachedata.RemoveNodeCommand;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.invocation.CacheTransactionHelper;
import org.jboss.cache.invocation.InterceptorChain;
@@ -55,6 +56,7 @@
this.backup = backup;
}
+ @Inject
public void initialize(BuddyManager buddyManager, InterceptorChain invoker, CacheTransactionHelper transactionHelper,
CommandsFactory commandsFactory, CacheData cacheData)
{
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -7,6 +7,7 @@
import org.jboss.cache.commands.BaseCacheCommand;
import org.jboss.cache.commands.CacheCommand;
import org.jboss.cache.commands.CacheCommandsVisitor;
+import org.jboss.cache.factories.annotations.Inject;
/**
* @author Mircea.Markus(a)jboss.com
@@ -30,6 +31,7 @@
this.groupName = groupName;
}
+ @Inject
public void initialize(BuddyManager buddyManager)
{
this.buddyManager = buddyManager;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -7,6 +7,7 @@
import org.jboss.cache.commands.GravitateDataCommand;
import org.jboss.cache.commands.MarshallableCommand;
import org.jboss.cache.commands.cachedata.PutKeyValueCommand;
+import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.InterceptorChain;
import org.jboss.cache.marshall.MethodCallWrapper;
@@ -25,25 +26,17 @@
public static final int MULTIPLE_METHOD_ID = 14;
private InterceptorChain invoker;
- private List<MarshallableCommand> modifications;
-
/**
- * optimiscation - rather than constructing a new list each for scenarios where a single modification needs
- * to be replicated rather use this insance.
+ * optimisation - rather than constructing a new list each for scenarios where a single modification needs
+ * to be replicated rather use this instance.
*/
private MarshallableCommand singleModification;
+ private List<MarshallableCommand> modifications;
public ReplicateCommand()
{
}
- public ReplicateCommand(MarshallableCommand toReplicate, InterceptorChain invoker)
- {
- this.modifications = new ArrayList<MarshallableCommand>();
- modifications.add(toReplicate);
- this.invoker = invoker;
- }
-
public ReplicateCommand(List<MarshallableCommand> modifications)
{
this.modifications = modifications;
@@ -54,16 +47,18 @@
this.singleModification = command;
}
+ @Inject
+ public void initialize(InterceptorChain invoker)
+ {
+ this.invoker = invoker;
+ }
+
public Object perform(InvocationContext ctx) throws Throwable
{
- if (singleModification != null)
- {
- return processSingleCommand(modifications.get(0));
- }
- for (MarshallableCommand command : modifications)
- {
- processSingleCommand(command);
- }
+ if (singleModification != null) return processSingleCommand(singleModification);
+
+ for (MarshallableCommand command : modifications) processSingleCommand(command);
+
return null;
}
@@ -73,7 +68,9 @@
Object result;
try
{
- Object retVal = invoker.invoke(cacheCommand);
+ if (trace) log.trace("Invoking command " + cacheCommand + ", with originLocal flag set to false.");
+
+ Object retVal = invoker.invoke(cacheCommand, false);
// we only need to return values for a set of remote calls; not every call.
if (returnValueForRemoteCall(cacheCommand))
{
@@ -86,16 +83,21 @@
}
catch (Throwable ex)
{
- if (isForExternalMethod(cacheCommand))
+ if (!isPutForExternalRead(cacheCommand))
{
throw ex;
}
- else result = null;
+ else
+ {
+ if (trace)
+ log.trace("Caught an exception, but since this is a putForExternalRead() call, suppressing the exception. Exception is:", ex);
+ result = null;
+ }
}
return result;
}
- private boolean isForExternalMethod(CacheCommand cacheCommand)
+ private boolean isPutForExternalRead(CacheCommand cacheCommand)
{
if (!(cacheCommand instanceof PutKeyValueCommand)) return false;
PutKeyValueCommand pkvCommand = (PutKeyValueCommand) cacheCommand;
@@ -130,6 +132,7 @@
return new Object[]{new MethodCallWrapper(singleModification)};
}
+ @SuppressWarnings("unchecked")
public void setState(int commandId, Object[] args)
{
if (commandId == SINGLE_METHOD_ID)
@@ -148,4 +151,12 @@
for (MarshallableCommand cc : modifications) l.add(new MethodCallWrapper(cc));
return l;
}
+
+ @Override
+ public String toString()
+ {
+ return "ReplicateCommand{" +
+ "modifications=" + (modifications == null ? singleModification : modifications) +
+ '}';
+ }
}
\ No newline at end of file
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -73,6 +73,7 @@
// this.transactionHelper = transactionHelper;
// }
+
@Inject
public void initialize(StateTransferManager stateTransferManager, CacheLoaderManager cacheLoaderManager, Notifier notifier,
TransactionManager transactionManager, BuddyManager buddyManager, TransactionTable transactionTable,
@@ -464,7 +465,7 @@
public V put(Fqn<?> fqn, K key, V value)
{
GlobalTransaction tx = transactionHelper.getCurrentTransaction();
- PutKeyValueCommand command = commandsFactory.buildPutKeyValueCommand(tx, fqn, key, value, false, true);
+ PutKeyValueCommand command = commandsFactory.buildPutKeyValueCommand(tx, fqn, key, value, false, false);
return (V) invoke(command);
}
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/InterceptorChain.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/InterceptorChain.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/InterceptorChain.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -221,6 +221,17 @@
* Similar to {@link #invoke(org.jboss.cache.InvocationContext, org.jboss.cache.commands.CacheCommand)}, but
* constructs a invocation context on the fly, using {@link InvocationContextContainer#get()}
*/
+ public Object invoke(CacheCommand cacheCommand, boolean isOriginLocal) throws Throwable
+ {
+ InvocationContext ctxt = invocationContextContainer.get();
+ ctxt.setOriginLocal(isOriginLocal);
+ return cacheCommand.accept(ctxt, firstInChain);
+ }
+
+ /**
+ * Similar to {@link #invoke(org.jboss.cache.InvocationContext, org.jboss.cache.commands.CacheCommand)}, but
+ * constructs a invocation context on the fly, using {@link InvocationContextContainer#get()} and setting the origin local flag to it's default value.
+ */
public Object invoke(CacheCommand cacheCommand) throws Throwable
{
InvocationContext ctxt = invocationContextContainer.get();
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -115,7 +115,7 @@
// parse the stream as per normal.
Object[] retVal = objectFromObjectStreamRegionBased(in);
RegionalizedMethodCall rmc = new RegionalizedMethodCall();
- rmc.call = (MethodCall) retVal[0];
+ rmc.command = (CacheCommand) retVal[0];
rmc.region = (Fqn) retVal[1];
return rmc;
}
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -26,35 +26,48 @@
trace = log.isTraceEnabled();
}
- /**
- * Message contains a Command. Execute it against *this* object and return result.
- */
- @Override
- public Object handle(Message req)
+ protected boolean isValid(Message req)
{
if (server_obj == null)
{
- if (log.isErrorEnabled()) log.error("no method handler is registered. Discarding request.");
- return null;
+ log.error("no method handler is registered. Discarding request.");
+ return false;
}
if (req == null || req.getLength() == 0)
{
- if (log.isErrorEnabled()) log.error("message or message buffer is null");
- return null;
+ log.error("message or message buffer is null");
+ return false;
}
- try
+ return true;
+ }
+
+ /**
+ * Message contains a Command. Execute it against *this* object and return result.
+ */
+ @Override
+ public Object handle(Message req)
+ {
+ if (isValid(req))
{
- CacheCommand cmd = (CacheCommand) req_marshaller.objectFromByteBuffer(req.getBuffer());
+ try
+ {
+ CacheCommand cmd = (CacheCommand) req_marshaller.objectFromByteBuffer(req.getBuffer());
- if (trace) log.trace("[sender=" + req.getSrc() + "], command: " + cmd);
+ if (trace) log.trace("[sender=" + req.getSrc() + "], command: " + cmd);
- return cid.invoke(cmd);
+ return cid.invoke(cmd);
+ }
+ catch (Throwable x)
+ {
+ if (trace) log.trace("Problems invoking command", x);
+ return x;
+ }
}
- catch (Throwable x)
+ else
{
- return x;
+ return null;
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/InactiveRegionAwareRpcDispatcher.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/InactiveRegionAwareRpcDispatcher.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/InactiveRegionAwareRpcDispatcher.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -1,5 +1,6 @@
package org.jboss.cache.marshall;
+import org.jboss.cache.commands.CacheCommand;
import org.jgroups.Channel;
import org.jgroups.MembershipListener;
import org.jgroups.Message;
@@ -39,57 +40,45 @@
@Override
public Object handle(Message req)
{
- org.jgroups.blocks.MethodCall method_call;
-
- if (server_obj == null)
+ if (isValid(req))
{
- if (log.isErrorEnabled()) log.error("no method handler is registered. Discarding request.");
- return null;
- }
+ RegionalizedMethodCall rmc;
+ CacheCommand command;
- if (req == null || req.getLength() == 0)
- {
- if (log.isErrorEnabled()) log.error("message or message buffer is null");
- return null;
- }
-
- RegionalizedMethodCall rmc;
-
- try
- {
- // we will ALWAYS be using the marshaller to unmarshall requests.
- rmc = requestMarshaller.regionalizedMethodCallFromByteBuffer(req.getBuffer());
- method_call = rmc.call;
- }
- catch (Throwable e)
- {
- if (e instanceof InactiveRegionException)
+ try
{
- if (log.isTraceEnabled()) log.trace("Exception from marshaller: " + e.getMessage());
- return null;
+ // we will ALWAYS be using the marshaller to unmarshall requests.
+ rmc = requestMarshaller.regionalizedMethodCallFromByteBuffer(req.getBuffer());
+ command = rmc.command;
}
+ catch (Throwable e)
+ {
+ if (e instanceof InactiveRegionException)
+ {
+ if (trace) log.trace("Exception from marshaller: " + e.getMessage());
+ return null;
+ }
- if (log.isErrorEnabled()) log.error("exception unmarshalling object", e);
- return e;
- }
+ if (trace) log.error("exception unmarshalling object", e);
+ return e;
+ }
- try
- {
- if (log.isTraceEnabled())
- log.trace("[sender=" + req.getSrc() + "], method_call: " + method_call);
+ try
+ {
+ if (trace) log.trace("[sender=" + req.getSrc() + "], method_call: " + command);
- Object retVal = method_call.invoke(server_obj);
- return new RegionalizedReturnValue(retVal, rmc);
+ Object retVal = cid.invoke(command);
+ return new RegionalizedReturnValue(retVal, rmc);
+ }
+ catch (Throwable x)
+ {
+ if (trace) log.trace("Problems invoking command", x);
+ return x;
+ }
}
- catch (Throwable x)
+ else
{
- return x;
+ return null;
}
}
-
- @Override
- public String toString()
- {
- return getClass().getSimpleName() + "[Outgoing marshaller: " + req_marshaller + "; incoming marshaller: " + rsp_marshaller + "]";
- }
}
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/RegionalizedMethodCall.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/RegionalizedMethodCall.java 2008-04-12 23:00:29 UTC (rev 5543)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/RegionalizedMethodCall.java 2008-04-12 23:01:09 UTC (rev 5544)
@@ -1,6 +1,7 @@
package org.jboss.cache.marshall;
import org.jboss.cache.Fqn;
+import org.jboss.cache.commands.CacheCommand;
/**
* A regionalized MethodCall object, created when {@link Marshaller#regionalizedMethodCallFromByteBuffer(byte[])} or
@@ -15,6 +16,6 @@
*/
class RegionalizedMethodCall
{
- MethodCall call;
+ CacheCommand command;
Fqn region;
}
16 years, 2 months