[jbosscache-commits] JBoss Cache SVN: r6055 - in core/trunk/src: main/java/org/jboss/cache/buddyreplication and 26 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Thu Jun 26 10:18:50 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-06-26 10:18:49 -0400 (Thu, 26 Jun 2008)
New Revision: 6055

Added:
   core/trunk/src/main/java/org/jboss/cache/factories/context/
   core/trunk/src/main/java/org/jboss/cache/factories/context/ContextFactory.java
   core/trunk/src/main/java/org/jboss/cache/factories/context/ContextMetaFactory.java
   core/trunk/src/main/java/org/jboss/cache/factories/context/MVCCContextFactory.java
   core/trunk/src/main/java/org/jboss/cache/factories/context/OptimisticContextFactory.java
   core/trunk/src/main/java/org/jboss/cache/factories/context/PessimisticContextFactory.java
   core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationContext.java
   core/trunk/src/main/java/org/jboss/cache/invocation/InvocationContext.java
   core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java
   core/trunk/src/main/java/org/jboss/cache/invocation/MVCCInvocationContext.java
   core/trunk/src/main/java/org/jboss/cache/transaction/MVCCTransactionContext.java
   core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java
   core/trunk/src/main/java/org/jboss/cache/transaction/TransactionContext.java
Removed:
   core/trunk/src/main/java/org/jboss/cache/transaction/TransactionContext.java
Modified:
   core/trunk/src/main/java/org/jboss/cache/Cache.java
   core/trunk/src/main/java/org/jboss/cache/CacheSPI.java
   core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
   core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
   core/trunk/src/main/java/org/jboss/cache/buddyreplication/Fqn2BuddyFqnVisitor.java
   core/trunk/src/main/java/org/jboss/cache/commands/AbstractVisitor.java
   core/trunk/src/main/java/org/jboss/cache/commands/ReplicableCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/VisitableCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/Visitor.java
   core/trunk/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/read/GetNodeCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.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/AbstractTransactionCommand.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/write/ClearDataCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/write/CreateNodeCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/write/OptimisticInvalidateCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/write/PutForExternalReadCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java
   core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/BaseTransactionalContextInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.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/InterceptorChain.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.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/OptimisticTxInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.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/ReplicationInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/base/CommandInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/base/PostProcessingCommandInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationDelegate.java
   core/trunk/src/main/java/org/jboss/cache/invocation/InvocationContextContainer.java
   core/trunk/src/main/java/org/jboss/cache/lock/AbstractLockManager.java
   core/trunk/src/main/java/org/jboss/cache/lock/FqnLockManager.java
   core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java
   core/trunk/src/main/java/org/jboss/cache/lock/LockUtil.java
   core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java
   core/trunk/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java
   core/trunk/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java
   core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java
   core/trunk/src/main/java/org/jboss/cache/notifications/Notifier.java
   core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java
   core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java
   core/trunk/src/main/java/org/jboss/cache/transaction/OptimisticTransactionContext.java
   core/trunk/src/main/java/org/jboss/cache/transaction/TransactionTable.java
   core/trunk/src/test/java/org/jboss/cache/api/DestroyedCacheAPITest.java
   core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java
   core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java
   core/trunk/src/test/java/org/jboss/cache/api/mvcc/LockTest.java
   core/trunk/src/test/java/org/jboss/cache/commands/read/AbstractDataCommandTest.java
   core/trunk/src/test/java/org/jboss/cache/commands/read/GravitateDataCommandTest.java
   core/trunk/src/test/java/org/jboss/cache/commands/write/AbstractVersionedDataCommandTest.java
   core/trunk/src/test/java/org/jboss/cache/interceptors/LegacyInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/lock/AbstractLockManagerRecordingTest.java
   core/trunk/src/test/java/org/jboss/cache/lock/MVCCLockManagerRecordingTest.java
   core/trunk/src/test/java/org/jboss/cache/lock/NodeBasedLockManagerRecordingTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java
   core/trunk/src/test/java/org/jboss/cache/notifications/NotifierTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/MockFailureInterceptor.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/MockInterceptor.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticLockInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java
   core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java
   core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java
Log:
Invocation and Transaction Context refactoring.

- introduced interfaces in front of each context
- introduced factories to construct them
- introduced better javadocs

Modified: core/trunk/src/main/java/org/jboss/cache/Cache.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/Cache.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/Cache.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -8,6 +8,7 @@
 
 import net.jcip.annotations.ThreadSafe;
 import org.jboss.cache.config.Configuration;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jgroups.Address;
 
 import java.util.List;
@@ -352,7 +353,7 @@
    InvocationContext getInvocationContext();
 
    /**
-    * Sets the passed in {@link org.jboss.cache.InvocationContext} as current.
+    * Sets the passed in {@link org.jboss.cache.invocation.InvocationContext} as current.
     *
     * @param ctx invocation context to use
     * @throws IllegalStateException if the cache has been destroyed.

Modified: core/trunk/src/main/java/org/jboss/cache/CacheSPI.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/CacheSPI.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/CacheSPI.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -10,6 +10,7 @@
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.buddyreplication.GravitateResult;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.loader.CacheLoaderManager;
 import org.jboss.cache.marshall.Marshaller;

Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -16,6 +16,7 @@
 import org.jboss.cache.factories.annotations.Start;
 import org.jboss.cache.factories.annotations.Stop;
 import org.jboss.cache.interceptors.InterceptorChain;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.invocation.InvocationContextContainer;
 import org.jboss.cache.lock.LockManager;
 import org.jboss.cache.lock.LockUtil;

Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -11,6 +11,7 @@
 import static org.jboss.cache.AbstractNode.NodeFlags.*;
 import org.jboss.cache.commands.write.CreateNodeCommand;
 import org.jboss.cache.factories.CommandsFactory;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.lock.IdentityLock;
 import org.jboss.cache.lock.LockStrategyFactory;
 import org.jboss.cache.marshall.MarshalledValue;

Modified: core/trunk/src/main/java/org/jboss/cache/buddyreplication/Fqn2BuddyFqnVisitor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/buddyreplication/Fqn2BuddyFqnVisitor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/buddyreplication/Fqn2BuddyFqnVisitor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,7 +1,6 @@
 package org.jboss.cache.buddyreplication;
 
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.AbstractVisitor;
 import org.jboss.cache.commands.ReversibleCommand;
 import org.jboss.cache.commands.read.ExistsCommand;
@@ -17,6 +16,7 @@
 import org.jboss.cache.commands.tx.RollbackCommand;
 import org.jboss.cache.commands.write.*;
 import org.jboss.cache.factories.CommandsFactory;
+import org.jboss.cache.invocation.InvocationContext;
 
 import java.util.ArrayList;
 import java.util.List;

Modified: core/trunk/src/main/java/org/jboss/cache/commands/AbstractVisitor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/AbstractVisitor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/AbstractVisitor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,6 +1,5 @@
 package org.jboss.cache.commands;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.read.ExistsCommand;
 import org.jboss.cache.commands.read.GetChildrenNamesCommand;
 import org.jboss.cache.commands.read.GetDataMapCommand;
@@ -13,6 +12,7 @@
 import org.jboss.cache.commands.tx.PrepareCommand;
 import org.jboss.cache.commands.tx.RollbackCommand;
 import org.jboss.cache.commands.write.*;
+import org.jboss.cache.invocation.InvocationContext;
 
 import java.util.Collection;
 

Modified: core/trunk/src/main/java/org/jboss/cache/commands/ReplicableCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/ReplicableCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/ReplicableCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,6 +1,6 @@
 package org.jboss.cache.commands;
 
-import org.jboss.cache.InvocationContext;
+import org.jboss.cache.invocation.InvocationContext;
 
 /**
  * The core of the command-based cache framework.  Commands correspond to specific areas of functionality in the cache,

Modified: core/trunk/src/main/java/org/jboss/cache/commands/VisitableCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/VisitableCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/VisitableCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,6 +1,6 @@
 package org.jboss.cache.commands;
 
-import org.jboss.cache.InvocationContext;
+import org.jboss.cache.invocation.InvocationContext;
 
 /**
  * A type of command that can accept {@link org.jboss.cache.commands.Visitor}s, such as {@link org.jboss.cache.interceptors.base.CommandInterceptor}s.

Modified: core/trunk/src/main/java/org/jboss/cache/commands/Visitor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/Visitor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/Visitor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,6 +1,5 @@
 package org.jboss.cache.commands;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.read.ExistsCommand;
 import org.jboss.cache.commands.read.GetChildrenNamesCommand;
 import org.jboss.cache.commands.read.GetDataMapCommand;
@@ -13,6 +12,7 @@
 import org.jboss.cache.commands.tx.PrepareCommand;
 import org.jboss.cache.commands.tx.RollbackCommand;
 import org.jboss.cache.commands.write.*;
+import org.jboss.cache.invocation.InvocationContext;
 
 /**
  * This interface is the core of JBoss Cache, where each {@link VisitableCommand} can be visited by a Visitor implementation.

Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,9 +1,8 @@
 package org.jboss.cache.commands.read;
 
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.Node;
 import org.jboss.cache.commands.Visitor;
+import org.jboss.cache.invocation.InvocationContext;
 
 /**
  * Checks whether a given node exists in current in-memory state of the cache.

Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,9 +1,9 @@
 package org.jboss.cache.commands.read;
 
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.Visitor;
+import org.jboss.cache.invocation.InvocationContext;
 
 import java.util.Collection;
 import java.util.Collections;

Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,9 +1,9 @@
 package org.jboss.cache.commands.read;
 
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.Visitor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.util.MapCopy;
 
 /**

Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -2,8 +2,11 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.*;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.Visitor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.notifications.Notifier;
 
 /**

Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,13 +1,10 @@
 package org.jboss.cache.commands.read;
 
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.Visitor;
+import org.jboss.cache.invocation.InvocationContext;
 
-import java.util.HashSet;
-import java.util.Set;
-
 /**
  * Implements functionality defined by {@link org.jboss.cache.Cache#getKeys(org.jboss.cache.Fqn)}
  * <p/>

Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/GetNodeCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GetNodeCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,8 +1,8 @@
 package org.jboss.cache.commands.read;
 
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.Visitor;
+import org.jboss.cache.invocation.InvocationContext;
 
 /**
  * Implements functionality defined by {@link org.jboss.cache.Cache#getNode(org.jboss.cache.Fqn)}

Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -2,11 +2,16 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.*;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
+import org.jboss.cache.NodeSPI;
 import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.buddyreplication.GravitateResult;
 import org.jboss.cache.commands.Visitor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.marshall.NodeData;
 import org.jgroups.Address;
 

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-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -2,9 +2,9 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jgroups.Address;
 
 /**

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-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,10 +1,10 @@
 package org.jboss.cache.commands.remote;
 
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.buddyreplication.BuddyGroup;
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.invocation.InvocationContext;
 
 import java.util.Arrays;
 import java.util.Map;

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-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -3,13 +3,13 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.DataContainer;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.DataCommand;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.read.ExistsCommand;
 import org.jboss.cache.commands.read.GetChildrenNamesCommand;
 import org.jboss.cache.commands.read.GetDataMapCommand;
 import org.jboss.cache.interceptors.InterceptorChain;
+import org.jboss.cache.invocation.InvocationContext;
 
 import java.util.ArrayList;
 import java.util.Collections;

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-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -4,7 +4,6 @@
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
 import org.jboss.cache.buddyreplication.BuddyManager;
@@ -13,6 +12,7 @@
 import org.jboss.cache.commands.write.RemoveNodeCommand;
 import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.interceptors.InterceptorChain;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.TransactionTable;
 

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-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,8 +1,8 @@
 package org.jboss.cache.commands.remote;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.invocation.InvocationContext;
 
 /**
  * Removes a buddy from a group.  This is not a {@link org.jboss.cache.commands.VisitableCommand} and hence

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-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -2,12 +2,12 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.commands.read.GravitateDataCommand;
 import org.jboss.cache.commands.write.PutForExternalReadCommand;
 import org.jboss.cache.interceptors.InterceptorChain;
+import org.jboss.cache.invocation.InvocationContext;
 
 import java.util.ArrayList;
 import java.util.List;

Modified: core/trunk/src/main/java/org/jboss/cache/commands/tx/AbstractTransactionCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/tx/AbstractTransactionCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/tx/AbstractTransactionCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,7 +1,7 @@
 package org.jboss.cache.commands.tx;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.VisitableCommand;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.transaction.GlobalTransaction;
 
 /**

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-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/tx/CommitCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,7 +1,7 @@
 package org.jboss.cache.commands.tx;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.Visitor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.transaction.GlobalTransaction;
 
 /**

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-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,8 +1,8 @@
 package org.jboss.cache.commands.tx;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.ReversibleCommand;
 import org.jboss.cache.commands.Visitor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jgroups.Address;
 

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-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/tx/PrepareCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,9 +1,9 @@
 package org.jboss.cache.commands.tx;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.ReversibleCommand;
 import org.jboss.cache.commands.Visitor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jgroups.Address;
 

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-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/tx/RollbackCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,7 +1,7 @@
 package org.jboss.cache.commands.tx;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.Visitor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.transaction.GlobalTransaction;
 
 /**

Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -3,9 +3,9 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.Visitor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.notifications.event.NodeModifiedEvent;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -78,8 +78,9 @@
       NodeSPI nodeSpi = dataContainer.peek(fqn, false, true);
       if (nodeSpi == null)
       {
-         if (trace) log.trace("Not rolling back node clearance for node: " + fqn + " as it does not exist in the cache. " +
-               "This might be the result of an NoOp clear operation");
+         if (trace)
+            log.trace("Not rolling back node clearance for node: " + fqn + " as it does not exist in the cache. " +
+                  "This might be the result of an NoOp clear operation");
          return;
       }
       nodeSpi.putAllDirect(originalData);

Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/CreateNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/CreateNodeCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/CreateNodeCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,11 +1,11 @@
 package org.jboss.cache.commands.write;
 
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.ReversibleCommand;
 import org.jboss.cache.commands.Visitor;
 import org.jboss.cache.commands.read.AbstractDataCommand;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.transaction.GlobalTransaction;
 
 import java.util.LinkedList;
@@ -50,7 +50,7 @@
    /**
     * Creates a node in the cache, specified by the given Fqn.
     */
-   public Object perform(InvocationContext ctx) 
+   public Object perform(InvocationContext ctx)
    {
       Object[] results = dataContainer.createNodes(fqn);
       List<NodeSPI> created = (List<NodeSPI>) results[0];

Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,12 +1,12 @@
 package org.jboss.cache.commands.write;
 
+import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.DataContainer;
-import org.jboss.cache.notifications.Notifier;
 import org.jboss.cache.commands.Visitor;
 import org.jboss.cache.commands.read.AbstractDataCommand;
+import org.jboss.cache.invocation.InvocationContext;
+import org.jboss.cache.notifications.Notifier;
 
 import java.util.List;
 
@@ -43,7 +43,7 @@
    /**
     * Evicts a node.
     * <p/>
-    * See {@link org.jboss.cache.interceptors.EvictionInterceptor#visitEvictFqnCommand(org.jboss.cache.InvocationContext, EvictCommand)}
+    * See {@link org.jboss.cache.interceptors.EvictionInterceptor#visitEvictFqnCommand(org.jboss.cache.invocation.InvocationContext , EvictCommand)}
     * which is where the return value is used
     *
     * @return true if the node was removed from the tree or if it is resident.  Returns false if the node still exists; i.e. was only data removed because it still has children.

Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -2,21 +2,18 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.*;
-import org.jboss.cache.notifications.Notifier;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.Visitor;
 import org.jboss.cache.commands.read.AbstractDataCommand;
-import org.jboss.cache.config.Option;
-import org.jboss.cache.optimistic.DataVersion;
+import org.jboss.cache.invocation.InvocationContext;
+import org.jboss.cache.notifications.Notifier;
 
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import java.util.Collections;
-import java.util.Map;
-
 /**
  * Removes a node's content from memory - never removes the node.
- * It also clenups data for resident nodes - which are not being touched by eviction. 
+ * It also clenups data for resident nodes - which are not being touched by eviction.
  *
  * @author Mircea.Markus at jboss.com
  * @since 2.2
@@ -82,7 +79,7 @@
 
    /**
     * //TODO: 2.2.0: rather than using CacheSPI this should use peek().  The other interceptors should obtain locks and load nodes if necessary for this InvalidateCommand.
-      //Even better - this can be handles in the interceptors before call interceptor
+    * //Even better - this can be handles in the interceptors before call interceptor
     */
    protected NodeSPI enforceNodeLoading()
    {
@@ -91,8 +88,8 @@
 
 
    /**
-    *  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.
+    * 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.
     */
    protected void invalidateNode(NodeSPI node)
    {

Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -2,10 +2,14 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.*;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.NodeNotExistsException;
+import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.ReversibleCommand;
 import org.jboss.cache.commands.Visitor;
 import org.jboss.cache.commands.read.AbstractDataCommand;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.notifications.Notifier;
 import org.jboss.cache.transaction.GlobalTransaction;
 

Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/OptimisticInvalidateCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/OptimisticInvalidateCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/OptimisticInvalidateCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -4,17 +4,16 @@
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheException;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.VersionedDataCommand;
 import org.jboss.cache.config.Option;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.transaction.GlobalTransaction;
 
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 import java.util.Collections;
-import java.util.Map;
 
 /**
  * Behaves like {@link org.jboss.cache.commands.write.InvalidateCommand}. Also, potentially throws a cache exception if

Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -3,9 +3,9 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.Visitor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.notifications.event.NodeModifiedEvent;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.transaction.GlobalTransaction;
@@ -104,7 +104,8 @@
       if (isVersioned())
       {
          return VERSIONED_METHOD_ID;
-      } else
+      }
+      else
       {
          return METHOD_ID;
       }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/PutForExternalReadCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/PutForExternalReadCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/PutForExternalReadCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,8 +1,8 @@
 package org.jboss.cache.commands.write;
 
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.Visitor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.transaction.GlobalTransaction;
 
 /**

Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -4,9 +4,9 @@
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheException;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.Visitor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.notifications.event.NodeModifiedEvent;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.transaction.GlobalTransaction;

Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -3,10 +3,9 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.NodeNotExistsException;
 import org.jboss.cache.commands.Visitor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.notifications.event.NodeModifiedEvent;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.transaction.GlobalTransaction;

Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -3,9 +3,9 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.Visitor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.transaction.GlobalTransaction;
 

Modified: core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -15,6 +15,7 @@
 import org.jboss.cache.factories.annotations.NonVolatile;
 import org.jboss.cache.factories.annotations.Start;
 import org.jboss.cache.factories.annotations.Stop;
+import org.jboss.cache.factories.context.ContextMetaFactory;
 import org.jboss.cache.util.BeanUtils;
 import org.jboss.cache.util.reflect.ReflectionUtil;
 
@@ -173,6 +174,7 @@
       s.add(TransactionManagerFactory.class);
       s.add(ReplicationQueueFactory.class);
       s.add(LockManagerFactory.class);
+      s.add(ContextMetaFactory.class);
       return s;
    }
 

Added: core/trunk/src/main/java/org/jboss/cache/factories/context/ContextFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/context/ContextFactory.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/factories/context/ContextFactory.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -0,0 +1,33 @@
+package org.jboss.cache.factories.context;
+
+import org.jboss.cache.invocation.InvocationContext;
+import org.jboss.cache.transaction.TransactionContext;
+
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+
+/**
+ * This is the factory responsible for creating {@link org.jboss.cache.invocation.InvocationContext}s and {@link org.jboss.cache.transaction.TransactionContext}s
+ * for requests, based on the configuration used.
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 3.0
+ */
+public interface ContextFactory
+{
+   /**
+    * @return a new invocation context
+    */
+   InvocationContext createInvocationContext();
+
+   /**
+    * @param tx JTA transaction to associate the new context with
+    * @return a new transaction context
+    * @throws javax.transaction.RollbackException
+    *          in the event of an invalid transaaction
+    * @throws javax.transaction.SystemException
+    *          in the event of an invalid transaction
+    */
+   TransactionContext createTransactionContext(Transaction tx) throws SystemException, RollbackException;
+}

Added: core/trunk/src/main/java/org/jboss/cache/factories/context/ContextMetaFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/context/ContextMetaFactory.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/factories/context/ContextMetaFactory.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -0,0 +1,30 @@
+package org.jboss.cache.factories.context;
+
+import org.jboss.cache.config.ConfigurationException;
+import org.jboss.cache.factories.ComponentFactory;
+import org.jboss.cache.factories.annotations.DefaultFactoryFor;
+
+/**
+ * Responsible for creating the appropriate {@link ContextFactory} based on configuration used.
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 3.0
+ */
+ at DefaultFactoryFor(classes = ContextFactory.class)
+public class ContextMetaFactory extends ComponentFactory
+{
+   @SuppressWarnings("unchecked")
+   protected <T> T construct(Class<T> componentType)
+   {
+      switch (configuration.getNodeLockingScheme())
+      {
+         case MVCC:
+            return (T) new MVCCContextFactory();
+         case OPTIMISTIC:
+            return (T) new OptimisticContextFactory();
+         case PESSIMISTIC:
+            return (T) new PessimisticContextFactory();
+      }
+      throw new ConfigurationException("Unknown configuration node locking scheme");
+   }
+}

Added: core/trunk/src/main/java/org/jboss/cache/factories/context/MVCCContextFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/context/MVCCContextFactory.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/factories/context/MVCCContextFactory.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -0,0 +1,29 @@
+package org.jboss.cache.factories.context;
+
+import org.jboss.cache.invocation.InvocationContext;
+import org.jboss.cache.invocation.MVCCInvocationContext;
+import org.jboss.cache.transaction.MVCCTransactionContext;
+import org.jboss.cache.transaction.TransactionContext;
+
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+
+/**
+ * Constructs contexts for MVCC locking
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 3.0
+ */
+public class MVCCContextFactory implements ContextFactory
+{
+   public InvocationContext createInvocationContext()
+   {
+      return new MVCCInvocationContext();
+   }
+
+   public TransactionContext createTransactionContext(Transaction tx) throws SystemException, RollbackException
+   {
+      return new MVCCTransactionContext(tx);
+   }
+}

Added: core/trunk/src/main/java/org/jboss/cache/factories/context/OptimisticContextFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/context/OptimisticContextFactory.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/factories/context/OptimisticContextFactory.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -0,0 +1,25 @@
+package org.jboss.cache.factories.context;
+
+import org.jboss.cache.factories.annotations.NonVolatile;
+import org.jboss.cache.transaction.OptimisticTransactionContext;
+import org.jboss.cache.transaction.TransactionContext;
+
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+
+/**
+ * Constructs contexts for optimistic locking
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 3.0
+ */
+ at NonVolatile
+public class OptimisticContextFactory extends PessimisticContextFactory
+{
+   @Override
+   public TransactionContext createTransactionContext(Transaction tx) throws SystemException, RollbackException
+   {
+      return new OptimisticTransactionContext(tx);
+   }
+}

Added: core/trunk/src/main/java/org/jboss/cache/factories/context/PessimisticContextFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/context/PessimisticContextFactory.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/factories/context/PessimisticContextFactory.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -0,0 +1,41 @@
+package org.jboss.cache.factories.context;
+
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.factories.annotations.NonVolatile;
+import org.jboss.cache.invocation.InvocationContext;
+import org.jboss.cache.invocation.LegacyInvocationContext;
+import org.jboss.cache.transaction.PessimisticTransactionContext;
+import org.jboss.cache.transaction.TransactionContext;
+
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+
+/**
+ * Constructs contexts for pessimistic locking
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 3.0
+ */
+ at NonVolatile
+public class PessimisticContextFactory implements ContextFactory
+{
+   DataContainer container;
+
+   @Inject
+   public void inject(DataContainer container)
+   {
+      this.container = container;
+   }
+
+   public InvocationContext createInvocationContext()
+   {
+      return new LegacyInvocationContext(container);
+   }
+
+   public TransactionContext createTransactionContext(Transaction tx) throws SystemException, RollbackException
+   {
+      return new PessimisticTransactionContext(tx);
+   }
+}

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,7 +1,6 @@
 package org.jboss.cache.interceptors;
 
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.Modification;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.AbstractVisitor;
@@ -20,6 +19,7 @@
 import org.jboss.cache.commands.write.RemoveNodeCommand;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.TransactionContext;
 

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -3,7 +3,6 @@
  */
 package org.jboss.cache.interceptors;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.RPCManager;
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.cluster.ReplicationQueue;
@@ -14,6 +13,7 @@
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.TransactionContext;
 import org.jboss.cache.transaction.TransactionTable;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/BaseTransactionalContextInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/BaseTransactionalContextInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/BaseTransactionalContextInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,9 +1,9 @@
 package org.jboss.cache.interceptors;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.config.Option;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.TransactionContext;
 import org.jboss.cache.transaction.TransactionTable;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -3,7 +3,6 @@
 import org.jboss.cache.CacheException;
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.ReversibleCommand;
 import org.jboss.cache.commands.read.GetChildrenNamesCommand;
@@ -24,6 +23,7 @@
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.loader.CacheLoaderManager;
 import org.jboss.cache.lock.LockManager;
@@ -546,7 +546,7 @@
          node.setDataLoaded(false);
          if (transactionContext != null)
          {
-            transactionContext.loadUninitialisedNode(node.getFqn());
+            transactionContext.addDummyNodeCreatedByCacheLoader(node.getFqn());
          }
          lastCreated = node;
       }

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -22,7 +22,6 @@
 package org.jboss.cache.interceptors;
 
 import org.jboss.cache.DataContainer;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.read.GetKeyValueCommand;
 import org.jboss.cache.commands.write.EvictCommand;
 import org.jboss.cache.commands.write.PutDataMapCommand;
@@ -30,6 +29,7 @@
 import org.jboss.cache.commands.write.PutKeyValueCommand;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 
 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-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -3,7 +3,6 @@
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.Modification;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.AbstractVisitor;
@@ -24,6 +23,7 @@
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
 import org.jboss.cache.interceptors.base.SkipCheckChainedInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.loader.CacheLoaderManager;
 import org.jboss.cache.transaction.GlobalTransaction;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,6 +1,5 @@
 package org.jboss.cache.interceptors;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.ReversibleCommand;
 import org.jboss.cache.commands.VisitableCommand;
@@ -15,11 +14,9 @@
 import org.jboss.cache.commands.write.PutKeyValueCommand;
 import org.jboss.cache.commands.write.RemoveKeyCommand;
 import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.TransactionTable;
 
 import javax.transaction.Transaction;
 
@@ -36,22 +33,6 @@
  */
 public class CallInterceptor extends CommandInterceptor
 {
-   private TransactionTable transactionTable;
-   private boolean cacheLoadingEnabled;
-
-   @Inject
-   public void injectDependencies(TransactionTable transactionTable)
-   {
-      this.transactionTable = transactionTable;
-   }
-
-   @Start
-   public void startInterceptor()
-   {
-      cacheLoadingEnabled = configuration.getCacheLoaderConfig() != null &&
-            configuration.getCacheLoaderConfig().getFirstCacheLoaderConfig() != null;
-   }
-
    @Override
    public Object visitPrepareCommand(InvocationContext ctx, PrepareCommand command) throws Throwable
    {

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -10,7 +10,6 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.buddyreplication.GravitateResult;
@@ -28,6 +27,7 @@
 import org.jboss.cache.commands.tx.RollbackCommand;
 import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.marshall.NodeData;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jgroups.Address;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -9,7 +9,6 @@
 
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.Region;
 import org.jboss.cache.RegionManager;
@@ -27,6 +26,7 @@
 import org.jboss.cache.eviction.NodeEventType;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 
 /**
  * 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-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -21,15 +21,12 @@
  */
 package org.jboss.cache.interceptors;
 
-import org.apache.commons.logging.Log;
 import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 
 /**
  * Class representing an interceptor.
@@ -65,7 +62,7 @@
    /**
     * Using this method call for forwarding a call in the chain is not redable and error prone in the case of interceptors
     * extending other interceptors. This metod rather refers to interceptor doing its business operations rather than
-    * delegating to the nextInterceptor interceptor in chain. For delegation please use {@link #nextInterceptor(org.jboss.cache.InvocationContext)}
+    * delegating to the nextInterceptor interceptor in chain. For delegation please use {@link #nextInterceptor(org.jboss.cache.invocation.InvocationContext)}
     */
    public Object invoke(InvocationContext ctx) throws Throwable
    {
@@ -90,23 +87,6 @@
             + "}";
    }
 
-   /**
-    * First checks the invocation context for previously obtained reference to a node, if this doesn't exist, performs
-    * a cache.peek() and holds on to the node reference.
-    *
-    * @param ctx                 invocation context
-    * @param f                   fqn to find
-    * @param forceRefresh        forces calling cache.peek() even if we hold a reference to the relevant node.
-    * @param includeDeletedNodes includes nodes marked for deletion if this is true
-    * @param includeInvalidNodes includes nodes marked as invalid if this is true
-    * @return a node, or null if one cannot be found.
-    * @since 2.1.0
-    */
-   public NodeSPI peekNode(InvocationContext ctx, Fqn f, boolean forceRefresh, boolean includeDeletedNodes, boolean includeInvalidNodes)
-   {
-      return cache.peek(f, includeDeletedNodes, includeInvalidNodes);
-   }
-
    @Override
    @SuppressWarnings("deprecation")
    public Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -3,18 +3,18 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheException;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.invocation.InvocationContextContainer;
 import org.jboss.cache.util.CachePrinter;
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.ArrayList;
 
 /**
  * Knows how to build and manage an chain of interceptors. Also in charge with invoking methods on the chain.
@@ -229,7 +229,7 @@
    }
 
    /**
-    * Similar to {@link #invoke(org.jboss.cache.InvocationContext, org.jboss.cache.commands.VisitableCommand)}, but
+    * Similar to {@link #invoke(org.jboss.cache.invocation.InvocationContext , org.jboss.cache.commands.VisitableCommand)}, but
     * constructs a invocation context on the fly, using {@link InvocationContextContainer#get()}
     */
    public Object invokeRemote(VisitableCommand cacheCommand) throws Throwable
@@ -240,7 +240,7 @@
    }
 
    /**
-    * Similar to {@link #invoke(org.jboss.cache.InvocationContext, org.jboss.cache.commands.VisitableCommand)}, but
+    * Similar to {@link #invoke(org.jboss.cache.invocation.InvocationContext , org.jboss.cache.commands.VisitableCommand)}, 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(VisitableCommand cacheCommand) throws Throwable

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -7,7 +7,6 @@
 package org.jboss.cache.interceptors;
 
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.AbstractVisitor;
 import org.jboss.cache.commands.ReversibleCommand;
 import org.jboss.cache.commands.VisitableCommand;
@@ -28,6 +27,7 @@
 import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.optimistic.DefaultDataVersion;
 import org.jboss.cache.optimistic.TransactionWorkspace;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -6,21 +6,21 @@
  */
 package org.jboss.cache.interceptors;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.RPCManager;
 import org.jboss.cache.commands.VisitableCommand;
 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.write.ClearDataCommand;
 import org.jboss.cache.commands.write.PutDataMapCommand;
 import org.jboss.cache.commands.write.PutForExternalReadCommand;
 import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.commands.write.ClearDataCommand;
 import org.jboss.cache.commands.write.RemoveKeyCommand;
 import org.jboss.cache.commands.write.RemoveNodeCommand;
 import org.jboss.cache.config.Option;
 import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.TransactionTable;
 

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -2,7 +2,6 @@
 
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeFactory;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.VisitableCommand;
@@ -19,6 +18,7 @@
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
 import org.jboss.cache.interceptors.base.PostProcessingCommandInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.invocation.NodeInvocationDelegate;
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.lock.LockManager;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,6 +1,5 @@
 package org.jboss.cache.interceptors;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.read.GetChildrenNamesCommand;
 import org.jboss.cache.commands.read.GetDataMapCommand;
@@ -8,8 +7,12 @@
 import org.jboss.cache.commands.read.GetKeysCommand;
 import org.jboss.cache.commands.read.GetNodeCommand;
 import org.jboss.cache.commands.write.ClearDataCommand;
-import org.jboss.cache.commands.write.*;
+import org.jboss.cache.commands.write.PutDataMapCommand;
+import org.jboss.cache.commands.write.PutForExternalReadCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.commands.write.RemoveKeyCommand;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.marshall.MarshalledValue;
 import org.jboss.cache.marshall.MarshalledValueHelper;
 import org.jboss.cache.marshall.MarshalledValueMap;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,10 +1,10 @@
 package org.jboss.cache.interceptors;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.tx.CommitCommand;
 import org.jboss.cache.commands.tx.PrepareCommand;
 import org.jboss.cache.commands.tx.RollbackCommand;
 import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.notifications.Notifier;
 
 /**

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -10,7 +10,6 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeFactory;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.write.MoveCommand;
@@ -19,6 +18,7 @@
 import org.jboss.cache.commands.write.PutKeyValueCommand;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.notifications.Notifier;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.optimistic.DefaultDataVersion;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -8,11 +8,11 @@
 
 import org.jboss.cache.CacheException;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeFactory;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.lock.LockManager;
 import static org.jboss.cache.lock.LockType.READ;
 import org.jboss.cache.lock.TimeoutException;
@@ -74,9 +74,9 @@
    }
 
    /**
-    * @return the {@link org.jboss.cache.transaction.GlobalTransaction}, extracted from the current {@link org.jboss.cache.InvocationContext}.
+    * @return the {@link org.jboss.cache.transaction.GlobalTransaction}, extracted from the current {@link org.jboss.cache.invocation.InvocationContext}.
     * @throws CacheException if the {@link org.jboss.cache.transaction.GlobalTransaction} or {@link javax.transaction.Transaction} associated with the
-    *                        {@link org.jboss.cache.InvocationContext} is null.
+    *                        {@link org.jboss.cache.invocation.InvocationContext} is null.
     */
    protected GlobalTransaction getGlobalTransaction(InvocationContext ctx) throws CacheException
    {

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -7,13 +7,13 @@
 package org.jboss.cache.interceptors;
 
 import org.jboss.cache.CacheException;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.commands.tx.CommitCommand;
 import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
 import org.jboss.cache.commands.tx.RollbackCommand;
 import org.jboss.cache.factories.annotations.Start;
+import org.jboss.cache.invocation.InvocationContext;
 import static org.jboss.cache.lock.LockType.READ;
 import static org.jboss.cache.lock.LockType.WRITE;
 import org.jboss.cache.optimistic.TransactionWorkspace;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -10,7 +10,6 @@
 import org.jboss.cache.CacheException;
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeFactory;
 import org.jboss.cache.NodeNotExistsException;
 import org.jboss.cache.NodeSPI;
@@ -30,6 +29,7 @@
 import org.jboss.cache.config.Option;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.notifications.Notifier;
 import static org.jboss.cache.notifications.event.NodeModifiedEvent.ModificationType.*;
 import org.jboss.cache.optimistic.DataVersion;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -8,7 +8,6 @@
 
 import org.jboss.cache.CacheException;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.AbstractVisitor;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.ReversibleCommand;
@@ -28,6 +27,7 @@
 import org.jboss.cache.commands.write.RemoveNodeCommand;
 import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.optimistic.DataVersion;
 import org.jboss.cache.optimistic.DefaultDataVersion;
 import org.jboss.cache.optimistic.TransactionWorkspace;
@@ -45,8 +45,8 @@
  * Replication interceptor for the optimistically locked interceptor chain.  Responsible for replicating
  * state to remote nodes.  Unlike it's cousin, the {@link org.jboss.cache.interceptors.ReplicationInterceptor}, this interceptor
  * only deals with transactional calls.  Just like all things to do with Optimistic Locking, it is a requirement that
- * everything is done in a transaction and the transaction context is available via {@link org.jboss.cache.InvocationContext#getTransaction()}
- * and {@link org.jboss.cache.InvocationContext#getGlobalTransaction()}.
+ * everything is done in a transaction and the transaction context is available via {@link org.jboss.cache.invocation.InvocationContext#getTransaction()}
+ * and {@link org.jboss.cache.invocation.InvocationContext#getGlobalTransaction()}.
  *
  * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  * @author <a href="mailto:stevew at jofti.com">Steve Woodcock (stevew at jofti.com)</a>

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticTxInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticTxInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticTxInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,6 +1,5 @@
 package org.jboss.cache.interceptors;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.AbstractVisitor;
 import org.jboss.cache.commands.VersionedDataCommand;
 import org.jboss.cache.commands.VisitableCommand;
@@ -12,6 +11,7 @@
 import org.jboss.cache.commands.write.RemoveKeyCommand;
 import org.jboss.cache.commands.write.RemoveNodeCommand;
 import org.jboss.cache.config.Option;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionContext;
 import org.jboss.cache.transaction.TransactionContext;
@@ -150,12 +150,6 @@
       }
    }
 
-   @Override
-   protected TransactionContext createNewTransactionContext(Transaction tx) throws Exception
-   {
-      return new OptimisticTransactionContext(tx);
-   }
-
    private class ModificationsReplayVisitor extends AbstractVisitor
    {
       @Override

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -9,13 +9,13 @@
 import org.jboss.cache.CacheException;
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.tx.CommitCommand;
 import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
 import org.jboss.cache.commands.tx.RollbackCommand;
 import static org.jboss.cache.config.Configuration.CacheMode;
 import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.optimistic.DataVersioningException;
 import org.jboss.cache.optimistic.DefaultDataVersion;
 import org.jboss.cache.optimistic.TransactionWorkspace;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -2,11 +2,11 @@
 
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.write.EvictCommand;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.loader.CacheLoaderManager;
 import org.jboss.cache.notifications.Notifier;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -8,7 +8,6 @@
 
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.DataCommand;
 import org.jboss.cache.commands.VisitableCommand;
@@ -30,6 +29,7 @@
 import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.interceptors.base.PostProcessingCommandInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.lock.IsolationLevel;
 import org.jboss.cache.lock.LockManager;
 import static org.jboss.cache.lock.LockType.READ;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,6 +1,5 @@
 package org.jboss.cache.interceptors;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.ReversibleCommand;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.commands.tx.CommitCommand;
@@ -14,6 +13,7 @@
 import org.jboss.cache.commands.write.RemoveKeyCommand;
 import org.jboss.cache.commands.write.RemoveNodeCommand;
 import org.jboss.cache.config.Configuration;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.TransactionContext;
 

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -7,7 +7,6 @@
 package org.jboss.cache.interceptors;
 
 import org.jboss.cache.CacheException;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.RPCManager;
 import org.jboss.cache.ReplicationException;
 import org.jboss.cache.commands.AbstractVisitor;
@@ -29,6 +28,8 @@
 import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.ComponentRegistry;
 import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.factories.context.ContextFactory;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.invocation.InvocationContextContainer;
 import org.jboss.cache.lock.LockManager;
 import org.jboss.cache.notifications.Notifier;
@@ -66,6 +67,7 @@
    private Notifier notifier;
    private InvocationContextContainer invocationContextContainer;
    private ComponentRegistry componentRegistry;
+   private ContextFactory contextFactory;
 
    /**
     * List <Transaction>that we have registered for
@@ -79,10 +81,11 @@
    private LockManager lockManager;
 
    @Inject
-   public void intialize(RPCManager rpcManager,
+   public void intialize(RPCManager rpcManager, ContextFactory contextFactory,
                          Notifier notifier, InvocationContextContainer icc,
                          CommandsFactory factory, ComponentRegistry componentRegistry, LockManager lockManager)
    {
+      this.contextFactory = contextFactory;
       this.commandsFactory = factory;
       this.rpcManager = rpcManager;
       this.notifier = notifier;
@@ -367,7 +370,7 @@
          {
             // create a new transaction transactionContext
             if (log.isDebugEnabled()) log.debug("creating new tx transactionContext");
-            transactionContext = createNewTransactionContext(ltx);
+            transactionContext = contextFactory.createTransactionContext(ltx);
             txTable.put(gtx, transactionContext);
          }
 
@@ -448,11 +451,6 @@
       return retval;
    }
 
-   protected TransactionContext createNewTransactionContext(Transaction tx) throws Exception
-   {
-      return new TransactionContext(tx);
-   }
-
    private ReplicableCommand attachGlobalTransaction(InvocationContext ctx, Transaction tx, VisitableCommand command) throws Throwable
    {
       if (trace)

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/base/CommandInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/base/CommandInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/base/CommandInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -2,13 +2,13 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.AbstractVisitor;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
 import org.jboss.cache.interceptors.InterceptorMBean;
+import org.jboss.cache.invocation.InvocationContext;
 
 import java.util.Collections;
 import java.util.Map;
@@ -22,11 +22,11 @@
  * public interface, or by the {@link org.jboss.cache.marshall.CommandAwareRpcDispatcher} for remotely originating invocations, and
  * are passed up the interceptor chain by using the {@link org.jboss.cache.interceptors.InterceptorChain} helper class.
  * <p/>
- * When writing interceptors, authors can either override a specific visitXXX() method (such as {@link #visitGetKeyValueCommand(org.jboss.cache.InvocationContext, org.jboss.cache.commands.read.GetKeyValueCommand)})
- * or the more generic {@link #handleDefault(org.jboss.cache.InvocationContext, org.jboss.cache.commands.VisitableCommand)} which is the default behaviour of
- * any visit method, as defined in {@link org.jboss.cache.commands.AbstractVisitor#handleDefault(org.jboss.cache.InvocationContext, org.jboss.cache.commands.VisitableCommand)}.
+ * When writing interceptors, authors can either override a specific visitXXX() method (such as {@link #visitGetKeyValueCommand(org.jboss.cache.invocation.InvocationContext , org.jboss.cache.commands.read.GetKeyValueCommand)})
+ * or the more generic {@link #handleDefault(org.jboss.cache.invocation.InvocationContext , org.jboss.cache.commands.VisitableCommand)} which is the default behaviour of
+ * any visit method, as defined in {@link org.jboss.cache.commands.AbstractVisitor#handleDefault(org.jboss.cache.invocation.InvocationContext , org.jboss.cache.commands.VisitableCommand)}.
  * <p/>
- * The preferred approach is to override the specific visitXXX() methods that are of interest rather than to override {@link #handleDefault(org.jboss.cache.InvocationContext, org.jboss.cache.commands.VisitableCommand)}
+ * The preferred approach is to override the specific visitXXX() methods that are of interest rather than to override {@link #handleDefault(org.jboss.cache.invocation.InvocationContext , org.jboss.cache.commands.VisitableCommand)}
  * and then write a series of if statements or a switch block, if command-specific behaviour is needed.
  * <p/>
  *

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/base/PostProcessingCommandInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/base/PostProcessingCommandInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/base/PostProcessingCommandInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,6 +1,5 @@
 package org.jboss.cache.interceptors.base;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.commands.read.ExistsCommand;
 import org.jboss.cache.commands.read.GetChildrenNamesCommand;
@@ -14,16 +13,17 @@
 import org.jboss.cache.commands.tx.PrepareCommand;
 import org.jboss.cache.commands.tx.RollbackCommand;
 import org.jboss.cache.commands.write.*;
+import org.jboss.cache.invocation.InvocationContext;
 
 /**
- * This interceptor will call {@link #doAfterCall(org.jboss.cache.InvocationContext,org.jboss.cache.commands.VisitableCommand)} after invoking each visit method
- * (and the {@link #handleDefault(org.jboss.cache.InvocationContext, org.jboss.cache.commands.VisitableCommand)} method) in
+ * This interceptor will call {@link #doAfterCall(org.jboss.cache.invocation.InvocationContext ,org.jboss.cache.commands.VisitableCommand)} after invoking each visit method
+ * (and the {@link #handleDefault(org.jboss.cache.invocation.InvocationContext , org.jboss.cache.commands.VisitableCommand)} method) in
  * a <tt>finally</tt> block.
  * <p/>
  * It is useful if common cleanup code is required at the end of each call.
  * <p/>
  * Instead of overriding visitXXX() methods, implementations should override their handleXXX() counterparts defined in this class
- * instead, as well as the {@link #doAfterCall(org.jboss.cache.InvocationContext,org.jboss.cache.commands.VisitableCommand)} method.
+ * instead, as well as the {@link #doAfterCall(org.jboss.cache.invocation.InvocationContext ,org.jboss.cache.commands.VisitableCommand)} method.
  *
  * @author Mircea.Markus at jboss.com
  * @since 2.2

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-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,6 +1,5 @@
 package org.jboss.cache.interceptors.base;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.commands.read.ExistsCommand;
 import org.jboss.cache.commands.read.GetChildrenNamesCommand;
@@ -14,18 +13,26 @@
 import org.jboss.cache.commands.tx.PrepareCommand;
 import org.jboss.cache.commands.tx.RollbackCommand;
 import org.jboss.cache.commands.write.ClearDataCommand;
-import org.jboss.cache.commands.write.*;
+import org.jboss.cache.commands.write.EvictCommand;
+import org.jboss.cache.commands.write.InvalidateCommand;
+import org.jboss.cache.commands.write.MoveCommand;
+import org.jboss.cache.commands.write.PutDataMapCommand;
+import org.jboss.cache.commands.write.PutForExternalReadCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.commands.write.RemoveKeyCommand;
+import org.jboss.cache.commands.write.RemoveNodeCommand;
+import org.jboss.cache.invocation.InvocationContext;
 
 /**
- * This interceptor will call {@link #skipInterception(org.jboss.cache.InvocationContext,org.jboss.cache.commands.VisitableCommand)} before invoking each visit method
- * (and the {@link #handleDefault(org.jboss.cache.InvocationContext, org.jboss.cache.commands.VisitableCommand)} method).  If
- * {@link #skipInterception(org.jboss.cache.InvocationContext,org.jboss.cache.commands.VisitableCommand)} returns <tt>false</tt>, the invocation will be skipped
+ * This interceptor will call {@link #skipInterception(org.jboss.cache.invocation.InvocationContext ,org.jboss.cache.commands.VisitableCommand)} before invoking each visit method
+ * (and the {@link #handleDefault(org.jboss.cache.invocation.InvocationContext , org.jboss.cache.commands.VisitableCommand)} method).  If
+ * {@link #skipInterception(org.jboss.cache.invocation.InvocationContext ,org.jboss.cache.commands.VisitableCommand)} returns <tt>false</tt>, the invocation will be skipped
  * and passed up the interceptor chain instead.
  * <p/>
  * Instead of overriding visitXXX() methods, implementations should override their handleXXX() counterparts defined in this class
- * instead, as well as the {@link #skipInterception(org.jboss.cache.InvocationContext,org.jboss.cache.commands.VisitableCommand)} method.
- * Also, instead of overriding {@link #handleDefault(org.jboss.cache.InvocationContext, org.jboss.cache.commands.VisitableCommand)}, implementors
- * should override {@link #handleAll(org.jboss.cache.InvocationContext, org.jboss.cache.commands.VisitableCommand)}.
+ * instead, as well as the {@link #skipInterception(org.jboss.cache.invocation.InvocationContext ,org.jboss.cache.commands.VisitableCommand)} method.
+ * Also, instead of overriding {@link #handleDefault(org.jboss.cache.invocation.InvocationContext , org.jboss.cache.commands.VisitableCommand)}, implementors
+ * should override {@link #handleAll(org.jboss.cache.invocation.InvocationContext , org.jboss.cache.commands.VisitableCommand)}.
  *
  * @author Mircea.Markus at jboss.com
  * @since 2.2

Copied: core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationContext.java (from rev 6048, core/trunk/src/main/java/org/jboss/cache/InvocationContext.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationContext.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationContext.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -0,0 +1,368 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.cache.invocation;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.commands.VisitableCommand;
+import org.jboss.cache.config.Option;
+import org.jboss.cache.marshall.MethodCall;
+import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.cache.transaction.TransactionContext;
+import org.jboss.cache.transaction.TransactionTable;
+
+import javax.transaction.Transaction;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.List;
+
+/**
+ * This context holds information specific to a method invocation.  This is used for Optimistic and Pessimisic Node Locking Schemes.
+ *
+ * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
+ */
+ at SuppressWarnings("deprecation")
+public abstract class AbstractInvocationContext implements InvocationContext
+{
+   private static final Log log = LogFactory.getLog(AbstractInvocationContext.class);
+   private static final boolean trace = log.isTraceEnabled();
+
+   private Transaction transaction;
+   private GlobalTransaction globalTransaction;
+   protected TransactionContext transactionContext;
+   private Option optionOverrides;
+   // defaults to true.
+   private boolean originLocal = true;
+   private boolean txHasMods;
+   private boolean localRollbackOnly;
+   @Deprecated
+   private MethodCall methodCall;
+   @Deprecated
+   private VisitableCommand command;
+
+   /**
+    * LinkedHashSet of locks acquired by the invocation. We use a LinkedHashSet because we need efficient Set semantics
+    * but also need guaranteed ordering for use by lock release code (see JBCCACHE-874).
+    * <p/>
+    * This needs to be unchecked since we support both MVCC (Fqns held here) or legacy Opt/Pess locking (NodeLocks held here).
+    * once we drop support for opt/pess locks we can genericise this to contain Fqns. - Manik Surtani, June 2008
+    */
+   private LinkedHashSet invocationLocks;
+
+   public void setLocalRollbackOnly(boolean localRollbackOnly)
+   {
+      this.localRollbackOnly = localRollbackOnly;
+   }
+
+   public Transaction getTransaction()
+   {
+      return transaction;
+   }
+
+   public void setTransaction(Transaction transaction)
+   {
+      this.transaction = transaction;
+   }
+
+   public TransactionContext getTransactionContext()
+   {
+      return transactionContext;
+   }
+
+   public void setTransactionContext(TransactionContext transactionContext)
+   {
+      this.transactionContext = transactionContext;
+   }
+
+   public GlobalTransaction getGlobalTransaction()
+   {
+      return globalTransaction;
+   }
+
+   public void setGlobalTransaction(GlobalTransaction globalTransaction)
+   {
+      this.globalTransaction = globalTransaction;
+   }
+
+   public Option getOptionOverrides()
+   {
+      if (optionOverrides == null)
+      {
+         optionOverrides = new Option();
+      }
+      return optionOverrides;
+   }
+
+   public boolean isOptionsUninitialised()
+   {
+      return optionOverrides == null;
+   }
+
+   public void setOptionOverrides(Option optionOverrides)
+   {
+      this.optionOverrides = optionOverrides;
+   }
+
+   public boolean isOriginLocal()
+   {
+      return originLocal;
+   }
+
+   @SuppressWarnings("unchecked")
+   public List getLocks()
+   {
+      // first check transactional scope
+      if (transactionContext != null) return transactionContext.getLocks();
+      return invocationLocks == null ? Collections.emptyList() : Collections.unmodifiableList(new ArrayList(invocationLocks));
+   }
+
+   @SuppressWarnings("unchecked")
+   public void addAllLocks(List locks)
+   {
+      // first check transactional scope
+      if (transactionContext != null)
+      {
+         transactionContext.addAllLocks(locks);
+      }
+      else
+      {
+         // no need to worry about concurrency here - a context is only valid for a single thread.
+         if (invocationLocks == null) invocationLocks = new LinkedHashSet(5);
+         invocationLocks.addAll(locks);
+      }
+   }
+
+   @SuppressWarnings("unchecked")
+   public void addLock(Object lock)
+   {
+      // first check transactional scope
+      if (transactionContext != null)
+      {
+         transactionContext.addLock(lock);
+      }
+      else
+      {
+         // no need to worry about concurrency here - a context is only valid for a single thread.
+         if (invocationLocks == null) invocationLocks = new LinkedHashSet(5);
+         invocationLocks.add(lock);
+      }
+   }
+
+   @SuppressWarnings("unchecked")
+   public void removeLock(Object lock)
+   {
+      // first check transactional scope
+      if (transactionContext != null)
+      {
+         transactionContext.removeLock(lock);
+      }
+      else
+      {
+         // no need to worry about concurrency here - a context is only valid for a single thread.
+         if (invocationLocks != null) invocationLocks.remove(lock);
+      }
+   }
+
+   public void clearLocks()
+   {
+      // first check transactional scope
+      if (transactionContext != null)
+      {
+         transactionContext.clearLocks();
+      }
+      else
+      {
+         // no need to worry about concurrency here - a context is only valid for a single thread.
+         if (invocationLocks != null) invocationLocks.clear();
+      }
+   }
+
+   public boolean isLockingSuppressed()
+   {
+      return getOptionOverrides() != null && getOptionOverrides().isSuppressLocking();
+   }
+
+   public void setOriginLocal(boolean originLocal)
+   {
+      this.originLocal = originLocal;
+   }
+
+   @Override
+   public String toString()
+   {
+      return "InvocationContext{" +
+            "transaction=" + transaction +
+            ", globalTransaction=" + globalTransaction +
+            ", optionOverrides=" + optionOverrides +
+            ", originLocal=" + originLocal +
+            ", txHasMods=" + txHasMods +
+            '}';
+   }
+
+   public boolean isTxHasMods()
+   {
+      return txHasMods;
+   }
+
+   public void setTxHasMods(boolean b)
+   {
+      txHasMods = b;
+   }
+
+   public boolean isLocalRollbackOnly()
+   {
+      return localRollbackOnly;
+   }
+
+   public void reset()
+   {
+      transaction = null;
+      globalTransaction = null;
+      optionOverrides = null;
+      originLocal = true;
+      txHasMods = false;
+      invocationLocks = null;
+      methodCall = null;
+      command = null;
+   }
+
+   @SuppressWarnings("unchecked")
+   protected void doCopy(AbstractInvocationContext copy)
+   {
+      copy.command = command;
+      copy.globalTransaction = globalTransaction;
+      copy.invocationLocks = invocationLocks == null ? null : new LinkedHashSet(invocationLocks);
+      copy.localRollbackOnly = localRollbackOnly;
+      copy.optionOverrides = optionOverrides == null ? null : optionOverrides.copy();
+      copy.originLocal = originLocal;
+      copy.transaction = transaction;
+      copy.transactionContext = transactionContext;
+      copy.txHasMods = txHasMods;
+   }
+
+   public void setState(InvocationContext template)
+   {
+      if (template == null)
+      {
+         throw new NullPointerException("Template InvocationContext passed in to InvocationContext.setState() passed in is null");
+      }
+
+      this.setGlobalTransaction(template.getGlobalTransaction());
+      this.setLocalRollbackOnly(template.isLocalRollbackOnly());
+      this.setOptionOverrides(template.getOptionOverrides());
+      this.setOriginLocal(template.isOriginLocal());
+      this.setTransaction(template.getTransaction());
+      this.setTxHasMods(template.isTxHasMods());
+   }
+
+   @Override
+   public boolean equals(Object o)
+   {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+
+      final AbstractInvocationContext that = (AbstractInvocationContext) o;
+
+      if (localRollbackOnly != that.localRollbackOnly) return false;
+      if (originLocal != that.originLocal) return false;
+      if (txHasMods != that.txHasMods) return false;
+      if (globalTransaction != null ? !globalTransaction.equals(that.globalTransaction) : that.globalTransaction != null)
+      {
+         return false;
+      }
+      if (optionOverrides != null ? !optionOverrides.equals(that.optionOverrides) : that.optionOverrides != null)
+      {
+         return false;
+      }
+      if (transaction != null ? !transaction.equals(that.transaction) : that.transaction != null) return false;
+
+      return true;
+   }
+
+   @Override
+   public int hashCode()
+   {
+      int result;
+      result = (transaction != null ? transaction.hashCode() : 0);
+      result = 29 * result + (globalTransaction != null ? globalTransaction.hashCode() : 0);
+      result = 29 * result + (optionOverrides != null ? optionOverrides.hashCode() : 0);
+      result = 29 * result + (originLocal ? 1 : 0);
+      result = 29 * result + (txHasMods ? 1 : 0);
+      result = 29 * result + (localRollbackOnly ? 1 : 0);
+      return result;
+   }
+
+   @Deprecated
+   @SuppressWarnings("deprecation")
+   public MethodCall getMethodCall()
+   {
+      if (methodCall == null)
+      {
+         methodCall = createMethodCall();
+      }
+      return methodCall;
+   }
+
+   @SuppressWarnings("deprecation")
+   private MethodCall createMethodCall()
+   {
+      if (command == null) return null;
+      MethodCall call = new MethodCall();
+      call.setMethodId(command.getCommandId());
+      call.setArgs(command.getParameters());
+      return call;
+   }
+
+   @Deprecated
+   public void setMethodCall(MethodCall methodCall)
+   {
+      this.methodCall = methodCall;
+   }
+
+   public long getLockAcquisitionTimeout(long timeout)
+   {
+      if (getOptionOverrides() != null
+            && getOptionOverrides().getLockAcquisitionTimeout() >= 0)
+      {
+         timeout = getOptionOverrides().getLockAcquisitionTimeout();
+      }
+      return timeout;
+   }
+
+   @Deprecated
+   @SuppressWarnings("deprecation")
+   public void setCommand(VisitableCommand cacheCommand)
+   {
+      this.command = cacheCommand;
+   }
+
+   @Deprecated
+   @SuppressWarnings("deprecation")
+   public VisitableCommand getCommand()
+   {
+      return command;
+   }
+
+   public boolean isValidTransaction()
+   {
+      return transaction != null && TransactionTable.isValid(transaction);
+   }
+
+   public void throwIfNeeded(Throwable e) throws Throwable
+   {
+      Option optionOverride = getOptionOverrides();
+      boolean shouldRethtrow = optionOverride == null || !optionOverride.isFailSilently();
+      if (!shouldRethtrow)
+      {
+         if (trace)
+            log.trace("There was a problem handling this request, but failSilently was set, so suppressing exception", e);
+         return;
+      }
+      throw e;
+   }
+}


Property changes on: core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationContext.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Modified: core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationDelegate.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationDelegate.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -11,13 +11,10 @@
  * The JBoss Cache hand-wired interceptor stack.  A "minimal" AOP framework which uses delegation through an
  * interceptor chain rather than any bytecode manipulation.
  * <p/>
- * This class provides some generic behaviour such as the construction of an {@link org.jboss.cache.InvocationContext}
- * which is passed up the interceptor chain.
- * <p/>
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @see org.jboss.cache.interceptors.base.CommandInterceptor
- * @see org.jboss.cache.InvocationContext
+ * @see InvocationContext
  * @since 2.1.0
  */
 public abstract class AbstractInvocationDelegate

Added: core/trunk/src/main/java/org/jboss/cache/invocation/InvocationContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/InvocationContext.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/InvocationContext.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -0,0 +1,319 @@
+package org.jboss.cache.invocation;
+
+import org.jboss.cache.Fqn;
+import org.jboss.cache.NodeSPI;
+import org.jboss.cache.commands.VisitableCommand;
+import org.jboss.cache.config.Option;
+import org.jboss.cache.marshall.MethodCall;
+import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.cache.transaction.TransactionContext;
+
+import javax.transaction.Transaction;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A context that holds information regarding the scope of a single invocation.  May delegate some calls to a {@link org.jboss.cache.transaction.TransactionContext}
+ * if one is in scope.
+ * <p/>
+ * Note that prior to 3.0.0, InvocationContext was a concrete class and not an interface.
+ * <p/>
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @see org.jboss.cache.transaction.TransactionContext
+ */
+ at SuppressWarnings("deprecation")
+public interface InvocationContext
+{
+   /**
+    * Retrieves a node from the registry of looked up nodes in the current scope.
+    *
+    * @param fqn fqn to look up
+    * @return a node, or null if it cannot be found.
+    * @since 3.0.
+    */
+   NodeSPI lookUpNode(Fqn fqn);
+
+   /**
+    * Puts an entry in the registry of looked up nodes in the current scope.
+    *
+    * @param f fqn to add
+    * @param n node to add
+    * @since 3.0.
+    */
+   void putLookedUpNode(Fqn f, NodeSPI n);
+
+   /**
+    * Clears the registry of looked up nodes.
+    *
+    * @since 3.0.
+    */
+   void clearLookedUpNodes();
+
+   /**
+    * Retrieves a map of nodes looked up within the current invocation's scope.
+    *
+    * @return a map of looked up nodes.
+    * @since 3.0
+    */
+   Map<Fqn, NodeSPI> getLookedUpNodes();
+
+   /**
+    * Marks teh context as only rolling back.
+    *
+    * @param localRollbackOnly if true, the context is only rolling back.
+    */
+   void setLocalRollbackOnly(boolean localRollbackOnly);
+
+   /**
+    * Retrieves the transaction associated with this invocation
+    *
+    * @return The transaction associated with this invocation
+    */
+   Transaction getTransaction();
+
+   /**
+    * Sets a transaction object on the invocation context.
+    *
+    * @param transaction transaction to set
+    */
+   void setTransaction(Transaction transaction);
+
+   /**
+    * @return the transaction entry associated with the current transaction, or null if the current thread is not associated with a transaction.
+    * @since 2.2.0
+    */
+   TransactionContext getTransactionContext();
+
+   /**
+    * Sets the transaction context to be associated with the current thread.
+    *
+    * @param transactionContext transaction context to set
+    * @since 2.2.0
+    */
+   void setTransactionContext(TransactionContext transactionContext);
+
+   /**
+    * Retrieves the global transaction associated with this invocation
+    *
+    * @return the global transaction associated with this invocation
+    */
+   GlobalTransaction getGlobalTransaction();
+
+   /**
+    * Sets the global transaction associated with this invocation
+    *
+    * @param globalTransaction global transaction to set
+    */
+   void setGlobalTransaction(GlobalTransaction globalTransaction);
+
+   /**
+    * Retrieves the option overrides associated with this invocation
+    *
+    * @return the option overrides associated with this invocation
+    */
+   Option getOptionOverrides();
+
+   /**
+    * @return true of no options have been set on this context, false otherwise.
+    */
+   boolean isOptionsUninitialised();
+
+   /**
+    * Sets the option overrides to be associated with this invocation
+    *
+    * @param optionOverrides options to set
+    */
+   void setOptionOverrides(Option optionOverrides);
+
+   /**
+    * Tests if this invocation originated locally or from a remote cache.
+    *
+    * @return true if the invocation originated locally.
+    */
+   boolean isOriginLocal();
+
+   /**
+    * Returns an immutable,  defensive copy of the List of locks currently maintained for the current scope.
+    * <p/>
+    * Note that if a transaction is in scope, implementations should retrieve these locks from the {@link org.jboss.cache.transaction.TransactionContext}.
+    * Retrieving locks from this method should always ensure they are retrieved from  the appropriate scope.
+    * <p/>
+    * Note that currently (as of 3.0.0) this list is unchecked.  This is to allow support for both MVCC (which uses Fqns as locks)
+    * as well as legacy Optimistic and Pessimistic Locking schemes (which use {@link org.jboss.cache.lock.NodeLock} as locks).  Once support for
+    * legacy node locking schemes are dropped, this method will be more strongly typed to return <tt>List<Fqn></tt>.
+    *
+    * @return locks held in current scope.
+    */
+   @SuppressWarnings("unchecked")
+   List getLocks();
+
+   /**
+    * Adds a List of locks to the currently maintained collection of locks acquired.
+    * <p/>
+    * Note that if a transaction is in scope, implementations should record locks on the {@link org.jboss.cache.transaction.TransactionContext}.
+    * Adding locks using this method should always ensure they are applied to the appropriate scope.
+    * <p/>
+    * Note that currently (as of 3.0.0) this list is unchecked.  This is to allow support for both MVCC (which uses Fqns as locks)
+    * as well as legacy Optimistic and Pessimistic Locking schemes (which use {@link org.jboss.cache.lock.NodeLock} as locks).  Once support for
+    * legacy node locking schemes are dropped, this method will be more strongly typed to accept <tt>List<Fqn></tt>.
+    *
+    * @param locks locks to add
+    */
+   @SuppressWarnings("unchecked")
+   void addAllLocks(List locks);
+
+   /**
+    * Adds a lock to the currently maintained collection of locks acquired.
+    * <p/>
+    * Note that if a transaction is in scope, implementations should record this lock on the {@link org.jboss.cache.transaction.TransactionContext}.
+    * Using this method should always ensure that the appropriate scope is used.
+    * <p/>
+    * Note that currently (as of 3.0.0) this lock is weakly typed.  This is to allow support for both MVCC (which uses {@link Fqn}s as locks)
+    * as well as legacy Optimistic and Pessimistic Locking schemes (which use {@link org.jboss.cache.lock.NodeLock} as locks).  Once support for
+    * legacy node locking schemes are dropped, this method will be more strongly typed to accept {@link Fqn}.
+    *
+    * @param lock lock to add
+    */
+   @SuppressWarnings("unchecked")
+   void addLock(Object lock);
+
+   /**
+    * Removes a lock from the currently maintained collection of locks acquired.
+    * <p/>
+    * Note that if a transaction is in scope, implementations should remove this lock from the {@link org.jboss.cache.transaction.TransactionContext}.
+    * Using this method should always ensure that the lock is removed from the appropriate scope.
+    * <p/>
+    * Note that currently (as of 3.0.0) this lock is weakly typed.  This is to allow support for both MVCC (which uses {@link Fqn}s as locks)
+    * as well as legacy Optimistic and Pessimistic Locking schemes (which use {@link org.jboss.cache.lock.NodeLock} as locks).  Once support for
+    * legacy node locking schemes are dropped, this method will be more strongly typed to accept {@link Fqn}.
+    *
+    * @param lock lock to remove
+    */
+   @SuppressWarnings("unchecked")
+   void removeLock(Object lock);
+
+   /**
+    * Clears all locks from the currently maintained collection of locks acquired.
+    * <p/>
+    * Note that if a transaction is in scope, implementations should clear locks from the {@link org.jboss.cache.transaction.TransactionContext}.
+    * Using this method should always ensure locks are cleared in the appropriate scope.
+    * <p/>
+    * Note that currently (as of 3.0.0) this lock is weakly typed.  This is to allow support for both MVCC (which uses {@link Fqn}s as locks)
+    * as well as legacy Optimistic and Pessimistic Locking schemes (which use {@link org.jboss.cache.lock.NodeLock} as locks).  Once support for
+    * legacy node locking schemes are dropped, this method will be more strongly typed to accept {@link Fqn}.
+    */
+   void clearLocks();
+
+   /**
+    * @return true if options exist to suppress locking - false otherwise.  Note that this is only used by the {@link org.jboss.cache.interceptors.PessimisticLockInterceptor}.
+    */
+   boolean isLockingSuppressed();
+
+   /**
+    * If set to true, the invocation is assumed to have originated locally.  If set to false,
+    * assumed to have originated from a remote cache.
+    *
+    * @param originLocal flag to set
+    */
+   void setOriginLocal(boolean originLocal);
+
+   /**
+    * @return true if the current transaction has any modifications, false otherwise.
+    */
+   boolean isTxHasMods();
+
+   /**
+    * Sets whether modifications have been detected on the current transaction.
+    *
+    * @param b flag to set
+    */
+   void setTxHasMods(boolean b);
+
+   /**
+    * @return true if the current transaction is set to rollback only.
+    */
+   boolean isLocalRollbackOnly();
+
+   /**
+    * Resets the context, freeing up any references.
+    */
+   void reset();
+
+   /**
+    * This is a "copy-factory-method" that should be used whenever a clone of this class is needed.  The resulting instance
+    * is equal() to, but not ==, to the InvocationContext invoked on.  Note that this is a shallow copy with the exception
+    * of the Option object, which is deep, as well as any collections held on the context such as locks.  Note that the reference
+    * to a {@link org.jboss.cache.transaction.TransactionContext}, if any, is maintained.
+    *
+    * @return a new InvocationContext
+    */
+   @SuppressWarnings("unchecked")
+   InvocationContext copy();
+
+   /**
+    * Sets the state of the InvocationContext based on the template context passed in
+    *
+    * @param template template to copy from
+    */
+   void setState(InvocationContext template);
+
+   /**
+    * @return the method call associated with this invocation
+    */
+   @Deprecated
+   @SuppressWarnings("deprecation")
+   MethodCall getMethodCall();
+
+
+   /**
+    * Sets the method call associated with this invocation.
+    *
+    * @param methodCall methodcall to set
+    * @deprecated not used anymore.  Interceptors will get a {@link org.jboss.cache.commands.ReplicableCommand} instance passed in along with an InvocationContext.
+    */
+   @Deprecated
+   void setMethodCall(MethodCall methodCall);
+
+   /**
+    * If the lock acquisition timeout is overridden for current call using an option, then return that one.
+    * If not overridden, return default value.
+    *
+    * @param defaultTimeout timeout to fall back to
+    * @return timeout to use
+    */
+   long getLockAcquisitionTimeout(long defaultTimeout);
+
+   /**
+    * This is only used for backward compatibility with old interceptors implementation and should <b>NOT</b> be
+    * use by any new custom interceptors. The commands is now passed in as the second param in each implementing
+    * handlers (handler = method in ChainedInterceptor class)
+    *
+    * @param cacheCommand command to set
+    */
+   @Deprecated
+   @SuppressWarnings("deprecation")
+   void setCommand(VisitableCommand cacheCommand);
+
+   /**
+    * @return command that is in scope
+    * @see #setCommand(org.jboss.cache.commands.VisitableCommand)
+    */
+   @Deprecated
+   @SuppressWarnings("deprecation")
+   VisitableCommand getCommand();
+
+   /**
+    * @return true if there is current transaction associated with the invocation, and this transaction is in a valid state.
+    */
+   boolean isValidTransaction();
+
+   /**
+    * Throws the given throwable provided no options suppress or prevent this from happening.
+    *
+    * @param throwable throwable to throw
+    * @throws Throwable if allowed to throw one.
+    */
+   void throwIfNeeded(Throwable throwable
+   ) throws Throwable;
+}

Modified: core/trunk/src/main/java/org/jboss/cache/invocation/InvocationContextContainer.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/InvocationContextContainer.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/InvocationContextContainer.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,7 +1,8 @@
 package org.jboss.cache.invocation;
 
-import org.jboss.cache.InvocationContext;
+import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.NonVolatile;
+import org.jboss.cache.factories.context.ContextFactory;
 
 /**
  * Container and factory for thread locals
@@ -12,10 +13,18 @@
 @NonVolatile
 public class InvocationContextContainer extends ThreadLocal<InvocationContext>
 {
+   ContextFactory contextFactory;
+
+   @Inject
+   public void injectContextFactory(ContextFactory contextFactory)
+   {
+      this.contextFactory = contextFactory;
+   }
+
    @Override
    protected InvocationContext initialValue()
    {
       // create if this is initially unset
-      return new InvocationContext();
+      return contextFactory.createInvocationContext();
    }
 }

Added: core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -0,0 +1,51 @@
+package org.jboss.cache.invocation;
+
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.NodeSPI;
+
+import java.util.Map;
+
+/**
+ * This is to provide backward compatibility with legacy locking schemes.
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 3.0
+ */
+public class LegacyInvocationContext extends AbstractInvocationContext
+{
+   DataContainer container;
+
+   public LegacyInvocationContext(DataContainer container)
+   {
+      this.container = container;
+   }
+
+   public NodeSPI lookUpNode(Fqn fqn)
+   {
+      return container.peek(fqn);
+   }
+
+   public void putLookedUpNode(Fqn f, NodeSPI n)
+   {
+      throw new UnsupportedOperationException("Should not be called on legacy locking schemes!");
+   }
+
+   public void clearLookedUpNodes()
+   {
+      throw new UnsupportedOperationException("Should not be called on legacy locking schemes!");
+   }
+
+   public Map<Fqn, NodeSPI> getLookedUpNodes()
+   {
+      throw new UnsupportedOperationException("Should not be called on legacy locking schemes!");
+   }
+
+   @SuppressWarnings("unchecked")
+   public InvocationContext copy()
+   {
+      LegacyInvocationContext copy = new LegacyInvocationContext(container);
+      doCopy(copy);
+      return copy;
+   }
+}

Added: core/trunk/src/main/java/org/jboss/cache/invocation/MVCCInvocationContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/MVCCInvocationContext.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/MVCCInvocationContext.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -0,0 +1,103 @@
+package org.jboss.cache.invocation;
+
+import org.jboss.cache.Fqn;
+import org.jboss.cache.NodeSPI;
+import org.jboss.cache.transaction.MVCCTransactionContext;
+import org.jboss.cache.transaction.TransactionContext;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * An invocation context that is specific to MVCC locking
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 3.0
+ */
+public class MVCCInvocationContext extends AbstractInvocationContext
+{
+   private final Map<Fqn, NodeSPI> lookedUpNodes = new HashMap<Fqn, NodeSPI>();
+   private MVCCTransactionContext mvccTCtx;
+
+   @Override
+   public void setTransactionContext(TransactionContext transactionContext)
+   {
+      super.setTransactionContext(transactionContext);
+      mvccTCtx = (MVCCTransactionContext) transactionContext;
+   }
+
+   /**
+    * Retrieves a node from the registry of looked up nodes in the current scope.
+    * <p/>
+    * If a transaction is in progress, implementations should delegate to {@link org.jboss.cache.transaction.MVCCTransactionContext#lookUpNode(Fqn)}
+    * <p/>
+    *
+    * @param fqn fqn to look up
+    * @return a node, or null if it cannot be found.
+    */
+   public NodeSPI lookUpNode(Fqn fqn)
+   {
+      if (mvccTCtx != null) return mvccTCtx.lookUpNode(fqn);
+      return lookedUpNodes.get(fqn);
+   }
+
+   /**
+    * Puts an entry in the registry of looked up nodes in the current scope.
+    * <p/>
+    * If a transaction is in progress, implementations should delegate to {@link org.jboss.cache.transaction.MVCCTransactionContext#putLookedUpNode(Fqn, NodeSPI)}
+    * <p/>
+    *
+    * @param f fqn to add
+    * @param n node to add
+    */
+   public void putLookedUpNode(Fqn f, NodeSPI n)
+   {
+      if (mvccTCtx != null)
+         mvccTCtx.putLookedUpNode(f, n);
+      else
+         lookedUpNodes.put(f, n);
+   }
+
+   /**
+    * Clears the registry of looked up nodes.
+    * <p/>
+    * If a transaction is in progress, implementations should delegate to {@link org.jboss.cache.transaction.MVCCTransactionContext#clearLookedUpNodes()}.
+    */
+   public void clearLookedUpNodes()
+   {
+      if (mvccTCtx != null)
+         mvccTCtx.clearLookedUpNodes();
+      else
+         lookedUpNodes.clear();
+   }
+
+   /**
+    * Retrieves a map of nodes looked up within the current invocation's scope.
+    * <p/>
+    * If a transaction is in progress, implementations should delegate to {@link org.jboss.cache.transaction.MVCCTransactionContext#getLookedUpNodes()}.
+    * <p/>
+    *
+    * @return a map of looked up nodes.
+    */
+   public Map<Fqn, NodeSPI> getLookedUpNodes()
+   {
+      if (mvccTCtx != null) return mvccTCtx.getLookedUpNodes();
+      return lookedUpNodes;
+   }
+
+   @Override
+   public void reset()
+   {
+      super.reset();
+      lookedUpNodes.clear();
+   }
+
+   @SuppressWarnings("unchecked")
+   public InvocationContext copy()
+   {
+      MVCCInvocationContext copy = new MVCCInvocationContext();
+      doCopy(copy);
+      copy.lookedUpNodes.putAll(lookedUpNodes);
+      return copy;
+   }
+}

Modified: core/trunk/src/main/java/org/jboss/cache/lock/AbstractLockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/AbstractLockManager.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/lock/AbstractLockManager.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,9 +1,9 @@
 package org.jboss.cache.lock;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
+import org.jboss.cache.invocation.InvocationContext;
 
 /**
  * Common lock manager functionality

Modified: core/trunk/src/main/java/org/jboss/cache/lock/FqnLockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/FqnLockManager.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/lock/FqnLockManager.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,7 +1,7 @@
 package org.jboss.cache.lock;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
+import org.jboss.cache.invocation.InvocationContext;
 
 import java.util.Collection;
 

Modified: core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/lock/LockManager.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,8 +1,8 @@
 package org.jboss.cache.lock;
 
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
+import org.jboss.cache.invocation.InvocationContext;
 
 import java.util.Collection;
 
@@ -73,9 +73,9 @@
     * is specified in {@link org.jboss.cache.config.Option#getLockAcquisitionTimeout()} and, if this is unset, the default timeout
     * set in {@link org.jboss.cache.config.Configuration#getLockAcquisitionTimeout()} is used.
     * <p/>
-    * In addition, any locks acquired are added to the context OR transaction entry using {@link org.jboss.cache.InvocationContext#addLock(Object)}.
+    * In addition, any locks acquired are added to the context OR transaction entry using {@link org.jboss.cache.invocation.InvocationContext#addLock(Object)}.
     * <p/>
-    * The owner for the lock is determined by passing the invocation context to {@link #getLockOwner(org.jboss.cache.InvocationContext)}.
+    * The owner for the lock is determined by passing the invocation context to {@link #getLockOwner(org.jboss.cache.invocation.InvocationContext)}.
     * <p/>
     *
     * @param fqn      Fqn to lock
@@ -91,9 +91,9 @@
     * is specified in {@link org.jboss.cache.config.Option#getLockAcquisitionTimeout()} and, if this is unset, the default timeout
     * set in {@link org.jboss.cache.config.Configuration#getLockAcquisitionTimeout()} is used.
     * <p/>
-    * In addition, any locks acquired are added to the context OR transaction entry using {@link org.jboss.cache.InvocationContext#addLock(Object)}.
+    * In addition, any locks acquired are added to the context OR transaction entry using {@link org.jboss.cache.invocation.InvocationContext#addLock(Object)}.
     * <p/>
-    * The owner for the lock is determined by passing the invocation context to {@link #getLockOwner(org.jboss.cache.InvocationContext)}.
+    * The owner for the lock is determined by passing the invocation context to {@link #getLockOwner(org.jboss.cache.invocation.InvocationContext)}.
     * <p/>
     *
     * @param node     Fqn to lock
@@ -125,7 +125,7 @@
     * <p/>
     * Locks are released in reverse order of which they are acquired and registered.
     * <p/>
-    * Lock owner is determined by passing the invocation context to {@link #getLockOwner(org.jboss.cache.InvocationContext)}
+    * Lock owner is determined by passing the invocation context to {@link #getLockOwner(org.jboss.cache.invocation.InvocationContext)}
     * <p/>
     *
     * @param ctx invocation context to inspect
@@ -176,9 +176,9 @@
     * Locks the node and all child nodes, acquiring lock of type specified for the owner specified.  If only some locks are
     * acquired, all locks are released and the method returns false.
     * <p/>
-    * In addition, any locks acquired are added to the context OR transaction entry using {@link org.jboss.cache.InvocationContext#addLock(Object)}.
+    * In addition, any locks acquired are added to the context OR transaction entry using {@link org.jboss.cache.invocation.InvocationContext#addLock(Object)}.
     * <p/>
-    * The owner for the lock is determined by passing the invocation context to {@link #getLockOwner(org.jboss.cache.InvocationContext)}.
+    * The owner for the lock is determined by passing the invocation context to {@link #getLockOwner(org.jboss.cache.invocation.InvocationContext)}.
     * <p/>
     *
     * @param node     Node to lock
@@ -192,9 +192,9 @@
     * Locks the node and all child nodes, acquiring lock of type specified for the owner specified.  If only some locks are
     * acquired, all locks are released and the method returns false.
     * <p/>
-    * In addition, any locks acquired are added to the context OR transaction entry using {@link org.jboss.cache.InvocationContext#addLock(Object)}.
+    * In addition, any locks acquired are added to the context OR transaction entry using {@link org.jboss.cache.invocation.InvocationContext#addLock(Object)}.
     * <p/>
-    * The owner for the lock is determined by passing the invocation context to {@link #getLockOwner(org.jboss.cache.InvocationContext)}.
+    * The owner for the lock is determined by passing the invocation context to {@link #getLockOwner(org.jboss.cache.invocation.InvocationContext)}.
     * <p/>
     *
     * @param fqn      Node to lock

Modified: core/trunk/src/main/java/org/jboss/cache/lock/LockUtil.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/LockUtil.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/lock/LockUtil.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -3,10 +3,10 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.write.PutDataMapCommand;
 import org.jboss.cache.factories.CommandsFactory;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.statetransfer.StateTransferManager;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.TransactionContext;

Modified: core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -6,11 +6,11 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.Node;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.invocation.InvocationContextContainer;
 import org.jboss.cache.util.concurrent.locks.OwnableReentrantLock;
 
@@ -49,7 +49,7 @@
    private CacheSPI cache;
    private TransactionManager transactionManager;
    private InvocationContextContainer invocationContextContainer;
-   private static final int DEFAULT_CONCURRENCY = 20;
+   private static final int DEFAULT_CONCURRENCY = 100;
    private static final Log log = LogFactory.getLog(MVCCLockManager.class);
    private static final boolean trace = log.isTraceEnabled();
 
@@ -103,7 +103,7 @@
       assertIsWriteLock(lockType);
       if (trace) log.trace("Attempting to lock " + fqn);
       Lock lock = lockContainer.getLock(fqn);
-      if (lock.tryLock(ctx.getContextLockAcquisitionTimeout(lockAcquisitionTimeout), MILLISECONDS))
+      if (lock.tryLock(ctx.getLockAcquisitionTimeout(lockAcquisitionTimeout), MILLISECONDS))
       {
          ctx.addLock(fqn);
          return true;
@@ -205,7 +205,7 @@
    public boolean lockAllAndRecord(NodeSPI node, LockType lockType, InvocationContext ctx) throws InterruptedException
    {
       assertIsWriteLock(lockType);
-      return lockRecursively(node, ctx.getContextLockAcquisitionTimeout(lockAcquisitionTimeout), false, ctx);
+      return lockRecursively(node, ctx.getLockAcquisitionTimeout(lockAcquisitionTimeout), false, ctx);
    }
 
    public boolean lockAllAndRecord(Fqn fqn, LockType lockType, InvocationContext ctx) throws InterruptedException

Modified: core/trunk/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -4,10 +4,10 @@
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.Start;
+import org.jboss.cache.invocation.InvocationContext;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -101,7 +101,7 @@
 
    public boolean lockAndRecord(NodeSPI node, LockType lockType, InvocationContext ctx)
    {
-      NodeLock lock = acquireLock(node, lockType, getLockOwner(ctx), ctx.getContextLockAcquisitionTimeout(lockAcquisitionTimeout));
+      NodeLock lock = acquireLock(node, lockType, getLockOwner(ctx), ctx.getLockAcquisitionTimeout(lockAcquisitionTimeout));
       if (lock != null)
       {
          ctx.addLock(lock);
@@ -196,7 +196,7 @@
 
    public boolean lockAllAndRecord(NodeSPI node, LockType lockType, InvocationContext ctx)
    {
-      List<NodeLock> locks = lockAllNodes(node, lockType, getLockOwner(ctx), ctx.getContextLockAcquisitionTimeout(lockAcquisitionTimeout), false);
+      List<NodeLock> locks = lockAllNodes(node, lockType, getLockOwner(ctx), ctx.getLockAcquisitionTimeout(lockAcquisitionTimeout), false);
       if (locks == null) return false;
 
       if (locks.size() > 0)

Modified: core/trunk/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -3,10 +3,10 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.factories.CommandsFactory;
 import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.invocation.InvocationContext;
 import static org.jboss.cache.lock.LockType.WRITE;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.TransactionTable;
@@ -61,7 +61,7 @@
          return false;
 
       boolean created;
-      long timeout = zeroLockTimeout ? 0 : ctx.getContextLockAcquisitionTimeout(lockAcquisitionTimeout);
+      long timeout = zeroLockTimeout ? 0 : ctx.getLockAcquisitionTimeout(lockAcquisitionTimeout);
       // make sure we can bail out of this loop
       long cutoffTime = System.currentTimeMillis() + timeout;
       boolean firstTry = true;

Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,6 +1,5 @@
 package org.jboss.cache.marshall;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.commands.remote.AnnounceBuddyPoolNameCommand;
@@ -8,6 +7,7 @@
 import org.jboss.cache.commands.remote.RemoveFromBuddyGroupCommand;
 import org.jboss.cache.factories.ComponentRegistry;
 import org.jboss.cache.interceptors.InterceptorChain;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.invocation.InvocationContextContainer;
 import org.jgroups.Address;
 import org.jgroups.Channel;

Modified: core/trunk/src/main/java/org/jboss/cache/notifications/Notifier.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/notifications/Notifier.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/notifications/Notifier.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,8 +1,8 @@
 package org.jboss.cache.notifications;
 
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.buddyreplication.BuddyGroup;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.notifications.event.NodeModifiedEvent;
 import org.jgroups.View;
 
@@ -74,7 +74,7 @@
     * Notifies all registered listeners of a viewChange event.  Note that viewChange notifications are ALWAYS sent
     * immediately.
     */
-   void notifyViewChange(View new_view, InvocationContext ctx);
+   void notifyViewChange(View view, InvocationContext ctx);
 
    /**
     * Notifies all registered listeners of a buddy group change event.  Note that buddy group change notifications are ALWAYS sent

Modified: core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -12,7 +12,6 @@
 import org.jboss.cache.CacheException;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.buddyreplication.BuddyGroup;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.annotations.Destroy;
@@ -20,6 +19,7 @@
 import org.jboss.cache.factories.annotations.NonVolatile;
 import org.jboss.cache.factories.annotations.Start;
 import org.jboss.cache.factories.annotations.Stop;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.marshall.MarshalledValueMap;
 import org.jboss.cache.notifications.annotation.*;
 import org.jboss.cache.notifications.event.*;
@@ -550,7 +550,7 @@
 
    /**
     * Resets the current (passed-in) invocation, and returns a temp InvocationContext containing its state so it can
-    * be restored later using {@link #restoreInvocationContext(org.jboss.cache.InvocationContext)}
+    * be restored later using {@link #restoreInvocationContext(org.jboss.cache.invocation.InvocationContext)}
     *
     * @param ctx the current context to be reset
     * @return a clone of ctx, before it was reset

Modified: core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -11,7 +11,6 @@
 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.NodeFactory;
 import org.jboss.cache.NodeSPI;
@@ -19,6 +18,7 @@
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.eviction.EvictedEventNode;
 import org.jboss.cache.eviction.NodeEventType;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.loader.CacheLoaderManager;
 import org.jboss.cache.marshall.NodeData;

Added: core/trunk/src/main/java/org/jboss/cache/transaction/MVCCTransactionContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/MVCCTransactionContext.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/MVCCTransactionContext.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -0,0 +1,89 @@
+package org.jboss.cache.transaction;
+
+import org.jboss.cache.Fqn;
+import org.jboss.cache.NodeSPI;
+
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A transaction context specially geared to dealing with MVCC.
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 3.0
+ */
+public class MVCCTransactionContext extends PessimisticTransactionContext
+{
+   private final Map<Fqn, NodeSPI> lookedUpNodes = new HashMap<Fqn, NodeSPI>();
+
+   public MVCCTransactionContext(Transaction tx) throws SystemException, RollbackException
+   {
+      super(tx);
+   }
+
+   /**
+    * Retrieves a node from the registry of looked up nodes in the current scope.
+    * <p/>
+    * This is not normally called directly since {@link org.jboss.cache.invocation.InvocationContext#lookUpNode(org.jboss.cache.Fqn)}
+    * would delegate to this method if a transaction is in scope.
+    * <p/>
+    *
+    * @param fqn fqn to look up
+    * @return a node, or null if it cannot be found.
+    */
+   public NodeSPI lookUpNode(Fqn fqn)
+   {
+      return lookedUpNodes.get(fqn);
+   }
+
+   /**
+    * Puts an entry in the registry of looked up nodes in the current scope.
+    * <p/>
+    * This is not normally called directly since {@link org.jboss.cache.invocation.InvocationContext#putLookedUpNode(org.jboss.cache.Fqn, org.jboss.cache.NodeSPI)}
+    * would delegate to this method if a transaction is in scope.
+    * <p/>
+    *
+    * @param f fqn to add
+    * @param n node to add
+    */
+   public void putLookedUpNode(Fqn f, NodeSPI n)
+   {
+      lookedUpNodes.put(f, n);
+   }
+
+   /**
+    * Clears the registry of looked up nodes.
+    * <p/>
+    * This is not normally called directly since {@link org.jboss.cache.invocation.InvocationContext#clearLookedUpNodes()}
+    * would delegate to this method if a transaction is in scope.
+    * <p/>
+    */
+   public void clearLookedUpNodes()
+   {
+      lookedUpNodes.clear();
+   }
+
+   /**
+    * Retrieves a map of nodes looked up within the current invocation's scope.
+    * <p/>
+    * This is not normally called directly since {@link org.jboss.cache.invocation.InvocationContext#getLookedUpNodes()}
+    * would delegate to this method if a transaction is in scope.
+    * <p/>
+    *
+    * @return a map of looked up nodes.
+    */
+   public Map<Fqn, NodeSPI> getLookedUpNodes()
+   {
+      return lookedUpNodes;
+   }
+
+   @Override
+   public void reset()
+   {
+      super.reset();
+      lookedUpNodes.clear();
+   }
+}

Modified: core/trunk/src/main/java/org/jboss/cache/transaction/OptimisticTransactionContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/OptimisticTransactionContext.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/OptimisticTransactionContext.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -14,14 +14,14 @@
 import javax.transaction.Transaction;
 
 /**
- * Subclasses the {@link TransactionContext} class to add a {@link TransactionWorkspace}.  Used with optimistic locking
+ * Subclasses the {@link PessimisticTransactionContext} class to add a {@link TransactionWorkspace}.  Used with optimistic locking
  * where each call is assigned a trasnaction and a transaction workspace.
  *
  * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  * @author <a href="mailto:stevew at jofti.com">Steve Woodcock (stevew at jofti.com)</a>
  */
 
-public class OptimisticTransactionContext extends TransactionContext
+public class OptimisticTransactionContext extends PessimisticTransactionContext
 {
    private TransactionWorkspace transactionWorkSpace = new TransactionWorkspaceImpl();
 

Copied: core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java (from rev 6048, core/trunk/src/main/java/org/jboss/cache/transaction/TransactionContext.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -0,0 +1,297 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.cache.transaction;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.commands.ReversibleCommand;
+import org.jboss.cache.config.Option;
+import org.jboss.cache.interceptors.OrderedSynchronizationHandler;
+
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+
+/**
+ * Information associated with a {@link GlobalTransaction} about the transaction state.
+ * <p/>
+ * A TransactionContext maintains:
+ * <ul>
+ * <li>Handle to the local Transaction</li>
+ * <li>List of {@link org.jboss.cache.commands.ReversibleCommand}s that make up this transaction</li>
+ * <li>List of locks acquired</li>
+ * <li>Any transaction-scope options</li>
+ * </ul>
+ *
+ * @author <a href="mailto:bela at jboss.org">Bela Ban</a>
+ * @author Manik Surtani
+ * @version $Revision$
+ */
+public class PessimisticTransactionContext implements TransactionContext
+{
+
+   private static final Log log = LogFactory.getLog(PessimisticTransactionContext.class);
+   private static final boolean trace = log.isTraceEnabled();
+
+   /**
+    * Local transaction
+    */
+   private Transaction ltx = null;
+   private Option option;
+   private OrderedSynchronizationHandler orderedSynchronizationHandler;
+
+   private boolean forceAsyncReplication = false;
+   private boolean forceSyncReplication = false;
+
+   /**
+    * List&lt;ReversibleCommand&gt; of modifications ({@link ReversibleCommand}). They will be replicated on TX commit
+    */
+   private List<ReversibleCommand> modificationList;
+   /**
+    * A list of modifications that have been encountered with a LOCAL mode option.  These will be removed from the modification list during replication.
+    */
+   private List<ReversibleCommand> localModifications;
+
+   /**
+    * LinkedHashSet of locks acquired by the transaction. We use a LinkedHashSet because we need efficient Set semantics
+    * but also need guaranteed ordering for use by lock release code (see JBCCACHE-874).
+    * <p/>
+    * This needs to be unchecked since we support both MVCC (Fqns held here) or legacy Opt/Pess locking (NodeLocks held here).
+    * once we drop support for opt/pess locks we can genericise this to contain Fqns. - Manik Surtani, June 2008
+    */
+   private LinkedHashSet transactionLocks;
+
+   /**
+    * A list of dummy uninitialised nodes created by the cache loader interceptor to load data for a
+    * given node in this tx.
+    */
+   private List<Fqn> dummyNodesCreatedByCacheLoader;
+
+   /**
+    * List<Fqn> of nodes that have been removed by the transaction
+    */
+   private List<Fqn> removedNodes = null;
+
+   public PessimisticTransactionContext(Transaction tx) throws SystemException, RollbackException
+   {
+      ltx = tx;
+      orderedSynchronizationHandler = new OrderedSynchronizationHandler(tx);
+   }
+
+   public void addModification(ReversibleCommand command)
+   {
+      if (command == null) return;
+      if (modificationList == null) modificationList = new LinkedList<ReversibleCommand>();
+      modificationList.add(command);
+   }
+
+   public List<ReversibleCommand> getModifications()
+   {
+      if (modificationList == null) return Collections.emptyList();
+      return modificationList;
+   }
+
+   public void addLocalModification(ReversibleCommand command)
+   {
+      if (command == null) throw new NullPointerException("Command is null!");
+      if (localModifications == null) localModifications = new LinkedList<ReversibleCommand>();
+      localModifications.add(command);
+   }
+
+   public List<ReversibleCommand> getLocalModifications()
+   {
+      if (localModifications == null) return Collections.emptyList();
+      return localModifications;
+   }
+
+
+   public void addRemovedNode(Fqn fqn)
+   {
+      if (fqn == null) throw new NullPointerException("Fqn is null!");
+      if (removedNodes == null) removedNodes = new LinkedList<Fqn>();
+      removedNodes.add(fqn);
+   }
+
+   public List<Fqn> getRemovedNodes()
+   {
+      if (removedNodes == null) return Collections.emptyList();
+      return new ArrayList<Fqn>(removedNodes);
+   }
+
+   public void setTransaction(Transaction tx)
+   {
+      ltx = tx;
+   }
+
+   public Transaction getTransaction()
+   {
+      return ltx;
+   }
+
+   @SuppressWarnings("unchecked")
+   public void addLock(Object lock)
+   {
+      // no need to worry about concurrency here - a context is only valid for a single thread.
+      if (transactionLocks == null) transactionLocks = new LinkedHashSet(5);
+      transactionLocks.add(lock);
+   }
+
+   @SuppressWarnings("unchecked")
+   public void removeLock(Object lock)
+   {
+      // no need to worry about concurrency here - a context is only valid for a single thread.
+      if (transactionLocks != null) transactionLocks.remove(lock);
+   }
+
+   public void clearLocks()
+   {
+      if (transactionLocks != null) transactionLocks.clear();
+   }
+
+
+   @SuppressWarnings("unchecked")
+   public void addAllLocks(List newLocks)
+   {
+      // no need to worry about concurrency here - a context is only valid for a single thread.
+      if (transactionLocks == null) transactionLocks = new LinkedHashSet(5);
+      transactionLocks.addAll(newLocks);
+   }
+
+   @SuppressWarnings("unchecked")
+   public List getLocks()
+   {
+      return transactionLocks == null ? Collections.emptyList() : Collections.unmodifiableList(new ArrayList(transactionLocks));
+   }
+
+
+   public boolean isForceAsyncReplication()
+   {
+      return forceAsyncReplication;
+   }
+
+   public void setForceAsyncReplication(boolean forceAsyncReplication)
+   {
+      this.forceAsyncReplication = forceAsyncReplication;
+      if (forceAsyncReplication)
+      {
+         forceSyncReplication = false;
+      }
+   }
+
+   public boolean isForceSyncReplication()
+   {
+      return forceSyncReplication;
+   }
+
+   public void setForceSyncReplication(boolean forceSyncReplication)
+   {
+      this.forceSyncReplication = forceSyncReplication;
+      if (forceSyncReplication)
+      {
+         forceAsyncReplication = false;
+      }
+   }
+
+
+   public void undoOperations()
+   {
+      if (modificationList == null)
+      {
+         if (trace) log.trace("Modification list is null, no modifications in this transaction!");
+         return;
+      }
+
+      if (trace) log.trace("undoOperations " + modificationList);
+
+      ArrayList<ReversibleCommand> copy;
+//      synchronized (modificationList)
+//      {
+      // no need to sync?  Only one thread would access a transaction at any given time?
+      copy = new ArrayList<ReversibleCommand>(modificationList);
+//      }
+      for (ListIterator i = copy.listIterator(copy.size()); i.hasPrevious();)
+      {
+         Object undoOp = i.previous();
+         ReversibleCommand txCommand = (ReversibleCommand) undoOp;
+         if (log.isDebugEnabled()) log.debug("Calling rollback() on command " + undoOp);
+         txCommand.rollback();
+      }
+   }
+
+   /**
+    * Returns debug information about this transaction.
+    */
+   @Override
+   public String toString()
+   {
+      StringBuilder sb = new StringBuilder();
+      sb.append("TransactionEntry\nmodificationList: ").append(modificationList);
+      return sb.toString();
+   }
+
+   public void addDummyNodeCreatedByCacheLoader(Fqn fqn)
+   {
+      if (dummyNodesCreatedByCacheLoader == null)
+         dummyNodesCreatedByCacheLoader = new LinkedList<Fqn>();
+      dummyNodesCreatedByCacheLoader.add(fqn);
+   }
+
+   public List<Fqn> getDummyNodesCreatedByCacheLoader()
+   {
+      if (dummyNodesCreatedByCacheLoader == null) return Collections.emptyList();
+      return dummyNodesCreatedByCacheLoader;
+   }
+
+   public void setOption(Option o)
+   {
+      this.option = o;
+   }
+
+   public Option getOption()
+   {
+      return this.option;
+   }
+
+   public OrderedSynchronizationHandler getOrderedSynchronizationHandler()
+   {
+      return orderedSynchronizationHandler;
+   }
+
+   public void setOrderedSynchronizationHandler(OrderedSynchronizationHandler orderedSynchronizationHandler)
+   {
+      this.orderedSynchronizationHandler = orderedSynchronizationHandler;
+   }
+
+   public boolean hasModifications()
+   {
+      return modificationList != null && !modificationList.isEmpty();
+   }
+
+   public boolean hasLocalModifications()
+   {
+      return localModifications != null && !localModifications.isEmpty();
+   }
+
+   public void reset()
+   {
+      orderedSynchronizationHandler = null;
+      if (modificationList != null) modificationList = null;
+      if (localModifications != null) localModifications = null;
+      option = null;
+      if (transactionLocks != null) transactionLocks.clear();
+      if (dummyNodesCreatedByCacheLoader != null) dummyNodesCreatedByCacheLoader.clear();
+      if (removedNodes != null) removedNodes.clear();
+   }
+}


Property changes on: core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Deleted: core/trunk/src/main/java/org/jboss/cache/transaction/TransactionContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/TransactionContext.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/TransactionContext.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,502 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.cache.transaction;
-
-
-import net.jcip.annotations.ThreadSafe;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.ReversibleCommand;
-import org.jboss.cache.config.Option;
-import org.jboss.cache.interceptors.OrderedSynchronizationHandler;
-import org.jboss.cache.lock.NodeLock;
-
-import javax.transaction.RollbackException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-/**
- * Information associated with a {@link GlobalTransaction} about the transaction state.
- * <p/>
- * A TransactionContext maintains:
- * <ul>
- * <li>Handle to the local Transaction</li>
- * <li>List of {@link org.jboss.cache.commands.ReversibleCommand}s that make up this transaction</li>
- * <li>List of locks acquired</li>
- * <li>Any transaction-scope options</li>
- * </ul>
- *
- * @author <a href="mailto:bela at jboss.org">Bela Ban</a>
- * @author Manik Surtani
- * @version $Revision$
- */
- at ThreadSafe
-public class TransactionContext
-{
-
-   private static final Log log = LogFactory.getLog(TransactionContext.class);
-   private static final boolean trace = log.isTraceEnabled();
-
-   /**
-    * Local transaction
-    */
-   private Transaction ltx = null;
-   private Option option;
-   private OrderedSynchronizationHandler orderedSynchronizationHandler;
-
-   private boolean forceAsyncReplication = false;
-   private boolean forceSyncReplication = false;
-
-   /**
-    * List&lt;ReversibleCommand&gt; of modifications ({@link ReversibleCommand}). They will be replicated on TX commit
-    */
-   private List<ReversibleCommand> modificationList;
-   /**
-    * A list of modifications that have been encountered with a LOCAL mode option.  These will be removed from the modification list during replication.
-    */
-   private List<ReversibleCommand> localModifications;
-
-   /**
-    * LinkedHashSet of locks acquired by the transaction. We use a LinkedHashSet because we need efficient Set semantics
-    * but also need guaranteed ordering for use by lock release code (see JBCCACHE-874).
-    * <p/>
-    * This needs to be unchecked since we support both MVCC (Fqns held here) or legacy Opt/Pess locking (NodeLocks held here).
-    * once we drop support for opt/pess locks we can genericise this to contain Fqns. - Manik Surtani, June 2008
-    */
-   private LinkedHashSet transactionLocks;
-   private final Map<Fqn, NodeSPI> lookedUpNodes = new HashMap<Fqn, NodeSPI>();
-
-
-   /**
-    * A list of dummy uninitialised nodes created by the cache loader interceptor to load data for a
-    * given node in this tx.
-    */
-   private List<Fqn> dummyNodesCreatedByCacheLoader;
-
-   /**
-    * List<Fqn> of nodes that have been removed by the transaction
-    */
-   private final List<Fqn> removedNodes = new LinkedList<Fqn>();
-
-   public TransactionContext(Transaction tx) throws SystemException, RollbackException
-   {
-      ltx = tx;
-      orderedSynchronizationHandler = new OrderedSynchronizationHandler(tx);
-   }
-
-   /**
-    * Adds a modification to the modification list.
-    */
-   public void addModification(ReversibleCommand command)
-   {
-      if (command == null) return;
-      if (modificationList == null) modificationList = new LinkedList<ReversibleCommand>();
-      modificationList.add(command);
-   }
-
-   /**
-    * Returns all modifications.
-    */
-   public List<ReversibleCommand> getModifications()
-   {
-      if (modificationList == null) return Collections.emptyList();
-      return modificationList;
-   }
-
-   /**
-    * Adds a modification to the local modification list.
-    */
-   public void addLocalModification(ReversibleCommand command)
-   {
-      if (command == null) return;
-      if (localModifications == null) localModifications = new LinkedList<ReversibleCommand>();
-      localModifications.add(command);
-   }
-
-   /**
-    * Returns all modifications that have been invoked with the LOCAL cache mode option.  These will also be in the standard modification list.
-    */
-   public List<ReversibleCommand> getLocalModifications()
-   {
-      if (localModifications == null) return Collections.emptyList();
-      return localModifications;
-   }
-
-
-   /**
-    * Adds the node that has been removed.
-    *
-    * @param fqn
-    */
-   public void addRemovedNode(Fqn fqn)
-   {
-      removedNodes.add(fqn);
-   }
-
-   /**
-    * Gets the list of removed nodes.
-    */
-   public List<Fqn> getRemovedNodes()
-   {
-      return new ArrayList<Fqn>(removedNodes);
-   }
-
-   /**
-    * Sets the local transaction for this entry.
-    */
-   public void setTransaction(Transaction tx)
-   {
-      ltx = tx;
-   }
-
-   /**
-    * Returns a local transaction associated with this TransactionEntry
-    */
-   public Transaction getTransaction()
-   {
-      return ltx;
-   }
-
-   /**
-    * Adds a lock to the currently maintained collection of locks acquired.
-    * <p/>
-    * Most code could not use this method directly, but use {@link org.jboss.cache.InvocationContext#addLock(Object)} instead,
-    * which would delegate to this method if a transaction is in scope or otherwise use invocation-specific locks.
-    * <p/>
-    * Note that currently (as of 3.0.0) this lock is weakly typed.  This is to allow support for both MVCC (which uses {@link Fqn}s as locks)
-    * as well as legacy Optimistic and Pessimistic Locking schemes (which use {@link NodeLock} as locks).  Once support for
-    * legacy node locking schemes are dropped, this method will be more strongly typed to accept {@link Fqn}.
-    *
-    * @param lock lock to add
-    * @see org.jboss.cache.InvocationContext#addLock(Object)
-    */
-   @SuppressWarnings("unchecked")
-   public void addLock(Object lock)
-   {
-      // no need to worry about concurrency here - a context is only valid for a single thread.
-      if (transactionLocks == null) transactionLocks = new LinkedHashSet(5);
-      transactionLocks.add(lock);
-   }
-
-   /**
-    * Removes a lock from the currently maintained collection of locks acquired.
-    * <p/>
-    * Most code could not use this method directly, but use {@link org.jboss.cache.InvocationContext#removeLock(Object)}  instead,
-    * which would delegate to this method if a transaction is in scope or otherwise use invocation-specific locks.
-    * <p/>
-    * Note that currently (as of 3.0.0) this lock is weakly typed.  This is to allow support for both MVCC (which uses {@link Fqn}s as locks)
-    * as well as legacy Optimistic and Pessimistic Locking schemes (which use {@link NodeLock} as locks).  Once support for
-    * legacy node locking schemes are dropped, this method will be more strongly typed to accept {@link Fqn}.
-    *
-    * @param lock lock to remove
-    * @see org.jboss.cache.InvocationContext#removeLock(Object)
-    */
-   @SuppressWarnings("unchecked")
-   public void removeLock(Object lock)
-   {
-      // no need to worry about concurrency here - a context is only valid for a single thread.
-      if (transactionLocks != null) transactionLocks.remove(lock);
-   }
-
-   /**
-    * Clears all locks from the currently maintained collection of locks acquired.
-    * <p/>
-    * Most code could not use this method directly, but use {@link org.jboss.cache.InvocationContext#clearLocks()} instead,
-    * which would delegate to this method if a transaction is in scope or otherwise use invocation-specific locks.
-    * <p/>
-    * Note that currently (as of 3.0.0) this lock is weakly typed.  This is to allow support for both MVCC (which uses {@link Fqn}s as locks)
-    * as well as legacy Optimistic and Pessimistic Locking schemes (which use {@link NodeLock} as locks).  Once support for
-    * legacy node locking schemes are dropped, this method will be more strongly typed to accept {@link Fqn}.
-    *
-    * @see org.jboss.cache.InvocationContext#clearLocks()
-    */
-   public void clearLocks()
-   {
-      if (transactionLocks != null) transactionLocks.clear();
-   }
-
-
-   /**
-    * Adds a List of locks to the currently maintained collection of locks acquired.
-    * <p/>
-    * Most code could not use this method directly, but use {@link org.jboss.cache.InvocationContext#addAllLocks(java.util.List)} instead,
-    * which would delegate to this method if a transaction is in scope or otherwise use invocation-specific locks.
-    * <p/>
-    * Note that currently (as of 3.0.0) this list is unchecked.  This is to allow support for both MVCC (which uses Fqns as locks)
-    * as well as legacy Optimistic and Pessimistic Locking schemes (which use {@link NodeLock} as locks).  Once support for
-    * legacy node locking schemes are dropped, this method will be more strongly typed to accept <tt>List<Fqn></tt>.
-    *
-    * @param newLocks locks to add
-    * @see org.jboss.cache.InvocationContext#addAllLocks(java.util.List)
-    */
-   @SuppressWarnings("unchecked")
-   public void addAllLocks(List newLocks)
-   {
-      // no need to worry about concurrency here - a context is only valid for a single thread.
-      if (transactionLocks == null) transactionLocks = new LinkedHashSet(5);
-      transactionLocks.addAll(newLocks);
-   }
-
-   /**
-    * Returns an immutable,  defensive copy of the List of locks currently maintained for the transaction.
-    * <p/>
-    * Most code could not use this method directly, but use {@link org.jboss.cache.InvocationContext#getLocks()} instead,
-    * which would delegate to this method if a transaction is in scope or otherwise use invocation-specific locks.
-    * <p/>
-    * Note that currently (as of 3.0.0) this list is unchecked.  This is to allow support for both MVCC (which uses Fqns as locks)
-    * as well as legacy Optimistic and Pessimistic Locking schemes (which use {@link NodeLock} as locks).  Once support for
-    * legacy node locking schemes are dropped, this method will be more strongly typed to return <tt>List<Fqn></tt>.
-    *
-    * @return locks held in current scope.
-    * @see org.jboss.cache.InvocationContext#getLocks()
-    */
-   @SuppressWarnings("unchecked")
-   public List getLocks()
-   {
-      return transactionLocks == null ? Collections.emptyList() : Collections.unmodifiableList(new ArrayList(transactionLocks));
-   }
-
-
-   /**
-    * Gets the value of the forceAsyncReplication flag.  Used by ReplicationInterceptor and OptimisticReplicationInterceptor
-    * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
-    * a transactional context.
-    *
-    * @return true if the forceAsyncReplication flag is set to true.
-    */
-   public boolean isForceAsyncReplication()
-   {
-      return forceAsyncReplication;
-   }
-
-   /**
-    * Sets the value of the forceAsyncReplication flag.  Used by ReplicationInterceptor and OptimisticReplicationInterceptor
-    * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
-    * a transactional context. Also used by OptimisticReplicationInterceptor when dealing
-    * with {@link org.jboss.cache.config.Option#setForceAsynchronous(boolean)} in a
-    * non-transactional context (i.e. with an implicit transaction).
-    *
-    * @param forceAsyncReplication value of forceAsyncReplication
-    */
-   public void setForceAsyncReplication(boolean forceAsyncReplication)
-   {
-      this.forceAsyncReplication = forceAsyncReplication;
-      if (forceAsyncReplication)
-      {
-         forceSyncReplication = false;
-      }
-   }
-
-   /**
-    * Gets the value of the forceSyncReplication flag.  Used by ReplicationInterceptor and OptimisticReplicationInterceptor
-    * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
-    * a transactional context.
-    *
-    * @return true if the forceAsyncReplication flag is set to true.
-    */
-   public boolean isForceSyncReplication()
-   {
-      return forceSyncReplication;
-   }
-
-   /**
-    * Sets the value of the forceSyncReplication flag.  Used by ReplicationInterceptor and OptimisticReplicationInterceptor
-    * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
-    * a transactional context.
-    *
-    * @param forceSyncReplication value of forceSyncReplication
-    */
-   public void setForceSyncReplication(boolean forceSyncReplication)
-   {
-      this.forceSyncReplication = forceSyncReplication;
-      if (forceSyncReplication)
-      {
-         forceAsyncReplication = false;
-      }
-   }
-
-
-   /**
-    * Posts all undo operations to the CacheImpl.
-    */
-   public void undoOperations()
-   {
-      if (modificationList == null)
-      {
-         if (trace) log.trace("Modification list is null, no modifications in this transaction!");
-         return;
-      }
-
-      if (trace) log.trace("undoOperations " + modificationList);
-
-      ArrayList<ReversibleCommand> copy;
-//      synchronized (modificationList)
-//      {
-      // no need to sync?  Only one thread would access a transaction at any given time?
-      copy = new ArrayList<ReversibleCommand>(modificationList);
-//      }
-      for (ListIterator i = copy.listIterator(copy.size()); i.hasPrevious();)
-      {
-         Object undoOp = i.previous();
-         ReversibleCommand txCommand = (ReversibleCommand) undoOp;
-         if (log.isDebugEnabled()) log.debug("Calling rollback() on command " + undoOp);
-         txCommand.rollback();
-      }
-   }
-
-   /**
-    * Returns debug information about this transaction.
-    */
-   @Override
-   public String toString()
-   {
-      StringBuilder sb = new StringBuilder();
-      sb.append("TransactionEntry\nmodificationList: ").append(modificationList);
-      return sb.toString();
-   }
-
-   public void loadUninitialisedNode(Fqn fqn)
-   {
-      if (dummyNodesCreatedByCacheLoader == null)
-         dummyNodesCreatedByCacheLoader = new LinkedList<Fqn>();
-      dummyNodesCreatedByCacheLoader.add(fqn);
-   }
-
-   public List<Fqn> getDummyNodesCreatedByCacheLoader()
-   {
-      return dummyNodesCreatedByCacheLoader;
-   }
-
-   /**
-    * Sets a transaction-scope option override
-    *
-    * @param o
-    */
-   public void setOption(Option o)
-   {
-      this.option = o;
-   }
-
-   /**
-    * Retrieves a transaction scope option override
-    */
-   public Option getOption()
-   {
-      return this.option;
-   }
-
-   public OrderedSynchronizationHandler getOrderedSynchronizationHandler()
-   {
-      return orderedSynchronizationHandler;
-   }
-
-   public void setOrderedSynchronizationHandler(OrderedSynchronizationHandler orderedSynchronizationHandler)
-   {
-      this.orderedSynchronizationHandler = orderedSynchronizationHandler;
-   }
-
-   /**
-    * Returns true if modifications were registered to either modificationList or to class loader modifications list.
-    */
-   public boolean hasModifications()
-   {
-      return modificationList != null && !modificationList.isEmpty();
-   }
-
-   /**
-    * @return true if any modifications have been invoked with cache mode being LOCAL.
-    */
-   public boolean hasLocalModifications()
-   {
-      return localModifications != null && !localModifications.isEmpty();
-   }
-
-   /**
-    * Retrieves a node from the registry of looked up nodes in the current scope.
-    * <p/>
-    * This is not normally called directly since {@link org.jboss.cache.InvocationContext#lookUpNode(org.jboss.cache.Fqn)}
-    * would delegate to this method if a transaction is in scope.
-    * <p/>
-    *
-    * @param fqn fqn to look up
-    * @return a node, or null if it cannot be found.
-    * @since 3.0.
-    */
-   public NodeSPI lookUpNode(Fqn fqn)
-   {
-      return lookedUpNodes.get(fqn);
-   }
-
-   /**
-    * Puts an entry in the registry of looked up nodes in the current scope.
-    * <p/>
-    * This is not normally called directly since {@link org.jboss.cache.InvocationContext#putLookedUpNode(org.jboss.cache.Fqn, org.jboss.cache.NodeSPI)}
-    * would delegate to this method if a transaction is in scope.
-    * <p/>
-    *
-    * @param f fqn to add
-    * @param n node to add
-    * @since 3.0.
-    */
-   public void putLookedUpNode(Fqn f, NodeSPI n)
-   {
-      lookedUpNodes.put(f, n);
-   }
-
-   /**
-    * Clears the registry of looked up nodes.
-    * <p/>
-    * This is not normally called directly since {@link org.jboss.cache.InvocationContext#clearLookedUpNodes()}
-    * would delegate to this method if a transaction is in scope.
-    * <p/>
-    *
-    * @since 3.0.
-    */
-   public void clearLookedUpNodes()
-   {
-      lookedUpNodes.clear();
-   }
-
-   /**
-    * Retrieves a map of nodes looked up within the current invocation's scope.
-    * <p/>
-    * This is not normally called directly since {@link org.jboss.cache.InvocationContext#getLookedUpNodes()}
-    * would delegate to this method if a transaction is in scope.
-    * <p/>
-    *
-    * @return a map of looked up nodes.
-    * @since 3.0
-    */
-   public Map<Fqn, NodeSPI> getLookedUpNodes()
-   {
-      return lookedUpNodes;
-   }
-
-   /**
-    * Cleans up internal state
-    */
-   public void reset()
-   {
-      orderedSynchronizationHandler = null;
-      if (modificationList != null) modificationList = null;
-      if (localModifications != null) localModifications = null;
-      option = null;
-      if (transactionLocks != null) transactionLocks.clear();
-      if (dummyNodesCreatedByCacheLoader != null) dummyNodesCreatedByCacheLoader.clear();
-      removedNodes.clear();
-   }
-}

Added: core/trunk/src/main/java/org/jboss/cache/transaction/TransactionContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/TransactionContext.java	                        (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/TransactionContext.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -0,0 +1,253 @@
+package org.jboss.cache.transaction;
+
+import org.jboss.cache.Fqn;
+import org.jboss.cache.commands.ReversibleCommand;
+import org.jboss.cache.config.Option;
+import org.jboss.cache.interceptors.OrderedSynchronizationHandler;
+
+import javax.transaction.Transaction;
+import java.util.List;
+
+/**
+ * Captures information pertaining to a specific JTA transaction.
+ * <p/>
+ * This was a concrete class called TransactionEntry prior to 3.0.
+ * <p/>
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @see org.jboss.cache.invocation.InvocationContext
+ */
+public interface TransactionContext
+{
+   /**
+    * Adds a modification to the modification list.
+    *
+    * @param command modification
+    */
+   void addModification(ReversibleCommand command);
+
+   /**
+    * Returns all modifications.  If there are no modifications in this transaction this method will return an empty list.
+    *
+    * @return list of modifications.
+    */
+   List<ReversibleCommand> getModifications();
+
+   /**
+    * Adds a modification to the local modification list.
+    *
+    * @param command command to add to list.  Should not be null.
+    * @throws NullPointerException if the command to be added is null.
+    */
+   void addLocalModification(ReversibleCommand command);
+
+   /**
+    * Returns all modifications that have been invoked with the LOCAL cache mode option.  These will also be in the standard modification list.
+    *
+    * @return list of LOCAL modifications, or an empty list.
+    */
+   List<ReversibleCommand> getLocalModifications();
+
+   /**
+    * Adds the node that has been removed in the scope of the current transaction.
+    *
+    * @param fqn fqn that has been removed.
+    * @throws NullPointerException if the Fqn is null.
+    */
+   void addRemovedNode(Fqn fqn);
+
+   /**
+    * Gets the list of removed nodes.
+    *
+    * @return list of nodes removed in the current transaction scope.  Note that this method will return an empty list if nothing has been removed.  The list returned is defensively copied.
+    */
+   List<Fqn> getRemovedNodes();
+
+   /**
+    * Sets the local transaction to be associated with this transaction context.
+    *
+    * @param tx JTA transaction to associate with.
+    */
+   void setTransaction(Transaction tx);
+
+   /**
+    * Returns a local transaction associated with this context.
+    *
+    * @return a JTA transaction
+    */
+   Transaction getTransaction();
+
+   /**
+    * Adds a lock to the currently maintained collection of locks acquired.
+    * <p/>
+    * Most code could not use this method directly, but use {@link org.jboss.cache.invocation.InvocationContext#addLock(Object)} instead,
+    * which would delegate to this method if a transaction is in scope or otherwise use invocation-specific locks.
+    * <p/>
+    * Note that currently (as of 3.0.0) this lock is weakly typed.  This is to allow support for both MVCC (which uses {@link org.jboss.cache.Fqn}s as locks)
+    * as well as legacy Optimistic and Pessimistic Locking schemes (which use {@link org.jboss.cache.lock.NodeLock} as locks).  Once support for
+    * legacy node locking schemes are dropped, this method will be more strongly typed to accept {@link org.jboss.cache.Fqn}.
+    *
+    * @param lock lock to add
+    * @see org.jboss.cache.invocation.InvocationContext#addLock(Object)
+    */
+   @SuppressWarnings("unchecked")
+   void addLock(Object lock);
+
+   /**
+    * Removes a lock from the currently maintained collection of locks acquired.
+    * <p/>
+    * Most code could not use this method directly, but use {@link org.jboss.cache.invocation.InvocationContext#removeLock(Object)}  instead,
+    * which would delegate to this method if a transaction is in scope or otherwise use invocation-specific locks.
+    * <p/>
+    * Note that currently (as of 3.0.0) this lock is weakly typed.  This is to allow support for both MVCC (which uses {@link org.jboss.cache.Fqn}s as locks)
+    * as well as legacy Optimistic and Pessimistic Locking schemes (which use {@link org.jboss.cache.lock.NodeLock} as locks).  Once support for
+    * legacy node locking schemes are dropped, this method will be more strongly typed to accept {@link org.jboss.cache.Fqn}.
+    *
+    * @param lock lock to remove
+    * @see org.jboss.cache.invocation.InvocationContext#removeLock(Object)
+    */
+   @SuppressWarnings("unchecked")
+   void removeLock(Object lock);
+
+   /**
+    * Clears all locks from the currently maintained collection of locks acquired.
+    * <p/>
+    * Most code could not use this method directly, but use {@link org.jboss.cache.invocation.InvocationContext#clearLocks()} instead,
+    * which would delegate to this method if a transaction is in scope or otherwise use invocation-specific locks.
+    * <p/>
+    * Note that currently (as of 3.0.0) this lock is weakly typed.  This is to allow support for both MVCC (which uses {@link org.jboss.cache.Fqn}s as locks)
+    * as well as legacy Optimistic and Pessimistic Locking schemes (which use {@link org.jboss.cache.lock.NodeLock} as locks).  Once support for
+    * legacy node locking schemes are dropped, this method will be more strongly typed to accept {@link org.jboss.cache.Fqn}.
+    *
+    * @see org.jboss.cache.invocation.InvocationContext#clearLocks()
+    */
+   void clearLocks();
+
+   /**
+    * Adds a List of locks to the currently maintained collection of locks acquired.
+    * <p/>
+    * Most code could not use this method directly, but use {@link org.jboss.cache.invocation.InvocationContext#addAllLocks(java.util.List)} instead,
+    * which would delegate to this method if a transaction is in scope or otherwise use invocation-specific locks.
+    * <p/>
+    * Note that currently (as of 3.0.0) this list is unchecked.  This is to allow support for both MVCC (which uses Fqns as locks)
+    * as well as legacy Optimistic and Pessimistic Locking schemes (which use {@link org.jboss.cache.lock.NodeLock} as locks).  Once support for
+    * legacy node locking schemes are dropped, this method will be more strongly typed to accept <tt>List<Fqn></tt>.
+    *
+    * @param newLocks locks to add
+    * @see org.jboss.cache.invocation.InvocationContext#addAllLocks(java.util.List)
+    */
+   @SuppressWarnings("unchecked")
+   void addAllLocks(List newLocks);
+
+   /**
+    * Returns an immutable,  defensive copy of the List of locks currently maintained for the transaction.
+    * <p/>
+    * Most code could not use this method directly, but use {@link org.jboss.cache.invocation.InvocationContext#getLocks()} instead,
+    * which would delegate to this method if a transaction is in scope or otherwise use invocation-specific locks.
+    * <p/>
+    * Note that currently (as of 3.0.0) this list is unchecked.  This is to allow support for both MVCC (which uses Fqns as locks)
+    * as well as legacy Optimistic and Pessimistic Locking schemes (which use {@link org.jboss.cache.lock.NodeLock} as locks).  Once support for
+    * legacy node locking schemes are dropped, this method will be more strongly typed to return <tt>List<Fqn></tt>.
+    *
+    * @return locks held in current scope.
+    * @see org.jboss.cache.invocation.InvocationContext#getLocks()
+    */
+   @SuppressWarnings("unchecked")
+   List getLocks();
+
+   /**
+    * Gets the value of the forceAsyncReplication flag.  Used by ReplicationInterceptor and OptimisticReplicationInterceptor
+    * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
+    * a transactional context.
+    *
+    * @return true if the forceAsyncReplication flag is set to true.
+    */
+   boolean isForceAsyncReplication();
+
+   /**
+    * Sets the value of the forceAsyncReplication flag.  Used by ReplicationInterceptor and OptimisticReplicationInterceptor
+    * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
+    * a transactional context. Also used by OptimisticReplicationInterceptor when dealing
+    * with {@link org.jboss.cache.config.Option#setForceAsynchronous(boolean)} in a
+    * non-transactional context (i.e. with an implicit transaction).
+    *
+    * @param forceAsyncReplication value of forceAsyncReplication
+    */
+   void setForceAsyncReplication(boolean forceAsyncReplication);
+
+   /**
+    * Gets the value of the forceSyncReplication flag.  Used by ReplicationInterceptor and OptimisticReplicationInterceptor
+    * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
+    * a transactional context.
+    *
+    * @return true if the forceAsyncReplication flag is set to true.
+    */
+   boolean isForceSyncReplication();
+
+   /**
+    * Sets the value of the forceSyncReplication flag.  Used by ReplicationInterceptor and OptimisticReplicationInterceptor
+    * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
+    * a transactional context.
+    *
+    * @param forceSyncReplication value of forceSyncReplication
+    */
+   void setForceSyncReplication(boolean forceSyncReplication);
+
+   /**
+    * Calls a rollback on all modifications in reverse order.
+    */
+   void undoOperations();
+
+   /**
+    * Adds an Fqn to the list of uninitialized nodes created by the cache loader.
+    *
+    * @param fqn fqn to add.  Must not be null.
+    */
+   void addDummyNodeCreatedByCacheLoader(Fqn fqn);
+
+   /**
+    * @return a list of uninitialized nodes created by the cache loader, or an empty list.
+    */
+   List<Fqn> getDummyNodesCreatedByCacheLoader();
+
+   /**
+    * Sets a transaction-scope option override
+    *
+    * @param o option to set
+    */
+   void setOption(Option o);
+
+   /**
+    * Retrieves a transaction scope option override
+    *
+    * @return option
+    */
+   Option getOption();
+
+   /**
+    * @return the ordered sync handler associated with this transaction
+    */
+   OrderedSynchronizationHandler getOrderedSynchronizationHandler();
+
+   /**
+    * Associates an ordered sync handler with this transaction.
+    *
+    * @param orderedSynchronizationHandler to set
+    */
+   void setOrderedSynchronizationHandler(OrderedSynchronizationHandler orderedSynchronizationHandler);
+
+   /**
+    * @return true if modifications were registered to either modificationList or to class loader modifications list.
+    */
+   boolean hasModifications();
+
+   /**
+    * @return true if any modifications have been invoked with cache mode being LOCAL.
+    */
+   boolean hasLocalModifications();
+
+   /**
+    * Cleans up internal state, freeing up references.
+    */
+   void reset();
+}

Modified: core/trunk/src/main/java/org/jboss/cache/transaction/TransactionTable.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/TransactionTable.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/TransactionTable.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -9,12 +9,11 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.cache.CacheException;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.RPCManager;
-import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.annotations.Inject;
 import org.jboss.cache.factories.annotations.NonVolatile;
-import org.jboss.cache.factories.annotations.Start;
+import org.jboss.cache.factories.context.ContextFactory;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jgroups.Address;
 
 import javax.transaction.Status;
@@ -55,23 +54,16 @@
 
    private RPCManager rpcManager;
 
-   private boolean isOptimisticLocking;
-   private Configuration configuration;
+   private ContextFactory contextFactory;
 
    @Inject
-   public void initialize(TransactionManager transactionManager, RPCManager rpcManager, Configuration configuration)
+   public void initialize(TransactionManager transactionManager, RPCManager rpcManager, ContextFactory contextFactory)
    {
       this.transactionManager = transactionManager;
       this.rpcManager = rpcManager;
-      this.configuration = configuration;
+      this.contextFactory = contextFactory;
    }
 
-   @Start
-   public void start()
-   {
-      isOptimisticLocking = configuration.isNodeLockingOptimistic();
-   }
-
    /**
     * Returns the number of local transactions.
     */
@@ -401,7 +393,7 @@
          TransactionContext transactionContext;
          try
          {
-            transactionContext = isOptimisticLocking ? new OptimisticTransactionContext(tx) : new TransactionContext(tx);
+            transactionContext = contextFactory.createTransactionContext(tx);
          }
          catch (Exception e)
          {

Modified: core/trunk/src/test/java/org/jboss/cache/api/DestroyedCacheAPITest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/DestroyedCacheAPITest.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/api/DestroyedCacheAPITest.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -5,7 +5,6 @@
 import org.jboss.cache.CacheStatus;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.Node;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.notifications.annotation.CacheListener;
@@ -336,18 +335,6 @@
       assertEquals(CacheStatus.DESTROYED, cache.getCacheStatus());
    }
 
-   /**
-    * BES 2008/03/22.  I don't know what the correct behavior should be.
-    * The test checks the call succeeds, which is one possibility and is
-    * what the current impl does. Can be something else, just not NPE.
-    */
-   public void testInvocationContext()
-   {
-      InvocationContext ctx = new InvocationContext();
-      cache.setInvocationContext(ctx);
-      assertSame(ctx, cache.getInvocationContext());
-   }
-
    public void testGetVersion()
    {
       assertEquals(version, cache.getVersion());

Modified: core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/api/SyncReplTest.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -11,11 +11,11 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.Node;
 import org.jboss.cache.config.Configuration.CacheMode;
 import org.jboss.cache.config.Option;
 import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.util.TestingUtil;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;

Modified: core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -11,11 +11,11 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.Node;
 import org.jboss.cache.config.Configuration.CacheMode;
 import org.jboss.cache.config.Option;
 import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.util.TestingUtil;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;

Modified: core/trunk/src/test/java/org/jboss/cache/api/mvcc/LockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/LockTest.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/LockTest.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -150,4 +150,12 @@
 
       assertNoLocks();
    }
+
+   // TODO: Test other major API methods - remove, etc.
+   // TODO: Test that writes don't block reads.
+   // TODO: Test write conflicts - with and without allowing write skew.  Multiple cases involving concurrent removes, concurrent put + remove, etc.
+   // TODO: Test Replication with MVCC
+   // TODO: Test state transfer with MVCC
+   // TODO: Test Cache loading with MVCC
+   // TODO: Test spreading of Fqns among locks.  Need a better algorithm?
 }

Modified: core/trunk/src/test/java/org/jboss/cache/commands/read/AbstractDataCommandTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/commands/read/AbstractDataCommandTest.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/commands/read/AbstractDataCommandTest.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -3,7 +3,8 @@
 import static org.easymock.EasyMock.createMock;
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
+import org.jboss.cache.invocation.InvocationContext;
+import org.jboss.cache.invocation.LegacyInvocationContext;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -24,7 +25,7 @@
    final public void setUp()
    {
       container = createMock(DataContainer.class);
-      ctx = new InvocationContext();
+      ctx = new LegacyInvocationContext(container);
       moreSetup();
    }
 

Modified: core/trunk/src/test/java/org/jboss/cache/commands/read/GravitateDataCommandTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/commands/read/GravitateDataCommandTest.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/commands/read/GravitateDataCommandTest.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,11 +1,17 @@
 package org.jboss.cache.commands.read;
 
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.createStrictControl;
+import static org.easymock.EasyMock.expect;
 import org.easymock.IMocksControl;
-import org.jboss.cache.*;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.NodeSPI;
+import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
 import org.jboss.cache.buddyreplication.BuddyManager;
 import org.jboss.cache.buddyreplication.GravitateResult;
-import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
+import org.jboss.cache.invocation.InvocationContext;
+import org.jboss.cache.invocation.LegacyInvocationContext;
 import org.jboss.cache.mock.MockNodesFixture;
 import org.jboss.cache.mock.NodeSpiMock;
 import org.jgroups.stack.IpAddress;
@@ -21,7 +27,7 @@
  * @author Mircea.Markus at jboss.com
  * @since 2.2
  */
- at Test(groups="unit")
+ at Test(groups = "unit")
 public class GravitateDataCommandTest
 {
    GravitateDataCommand command;
@@ -40,7 +46,7 @@
       spiMock = control.createMock(CacheSPI.class);
       command = new GravitateDataCommand(fqn, true, new IpAddress());
       command.initialize(containerMock, spiMock, new BuddyFqnTransformer());
-      ctx = new InvocationContext();
+      ctx = new LegacyInvocationContext(containerMock);
    }
 
    public void testNonexistentNode()
@@ -81,7 +87,7 @@
 
       control.replay();
       GravitateResult result = (GravitateResult) command.perform(ctx);
-      assert  result.getNodeData()== listReference;
+      assert result.getNodeData() == listReference;
       control.verify();
    }
 

Modified: core/trunk/src/test/java/org/jboss/cache/commands/write/AbstractVersionedDataCommandTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/commands/write/AbstractVersionedDataCommandTest.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/commands/write/AbstractVersionedDataCommandTest.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -4,7 +4,8 @@
 import org.easymock.IMocksControl;
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
+import org.jboss.cache.invocation.InvocationContext;
+import org.jboss.cache.invocation.LegacyInvocationContext;
 import org.jboss.cache.mock.MockNodesFixture;
 import org.jboss.cache.notifications.Notifier;
 import org.jboss.cache.optimistic.DataVersion;
@@ -42,7 +43,7 @@
       nodes = new MockNodesFixture();
       globalTransaction = new GlobalTransaction();
       dataVersion = new DefaultDataVersion(10);
-      ctx = new InvocationContext();
+      ctx = new LegacyInvocationContext(container);
 
       AbstractVersionedDataCommand command = moreSetUp();
       command.initialize(notifier, container);

Modified: core/trunk/src/test/java/org/jboss/cache/interceptors/LegacyInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/interceptors/LegacyInterceptorTest.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/interceptors/LegacyInterceptorTest.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -4,9 +4,9 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.commands.write.PutKeyValueCommand;
 import org.testng.annotations.AfterTest;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.BeforeTest;

Modified: core/trunk/src/test/java/org/jboss/cache/lock/AbstractLockManagerRecordingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/AbstractLockManagerRecordingTest.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/lock/AbstractLockManagerRecordingTest.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,16 +1,16 @@
 package org.jboss.cache.lock;
 
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.UnversionedNode;
+import org.jboss.cache.factories.context.ContextFactory;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.invocation.InvocationContextContainer;
 import org.jboss.cache.invocation.NodeInvocationDelegate;
 import static org.jboss.cache.lock.LockType.WRITE;
 import org.jboss.cache.transaction.DummyTransaction;
 import org.jboss.cache.transaction.DummyTransactionManager;
 import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.TransactionContext;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
 
@@ -23,6 +23,7 @@
    LockManager lm;
    InvocationContextContainer icc;
    protected boolean fqnBasedLocking = true;
+   protected ContextFactory contextFactory;
 
    @AfterMethod
    public void tearDown()
@@ -52,7 +53,7 @@
       InvocationContext ctx = icc.get();
       ctx.setGlobalTransaction(new GlobalTransaction());
       ctx.setTransaction(new DummyTransaction(DummyTransactionManager.getInstance()));
-      ctx.setTransactionContext(new TransactionContext(ctx.getTransaction()));
+      ctx.setTransactionContext(contextFactory.createTransactionContext(ctx.getTransaction()));
 
       // lock and record.
       lm.lockAndRecord(node, WRITE, ctx);

Modified: core/trunk/src/test/java/org/jboss/cache/lock/MVCCLockManagerRecordingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/MVCCLockManagerRecordingTest.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/lock/MVCCLockManagerRecordingTest.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,11 +1,17 @@
 package org.jboss.cache.lock;
 
+import org.jboss.cache.Fqn;
+import org.jboss.cache.factories.context.MVCCContextFactory;
 import org.jboss.cache.invocation.InvocationContextContainer;
+import org.jboss.cache.lock.MVCCLockManager.LockContainer;
 import org.jboss.cache.transaction.DummyTransactionManager;
+import org.jboss.cache.util.TestingUtil;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import javax.transaction.TransactionManager;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
@@ -23,6 +29,20 @@
       mvccLockManager.injectDataContainer(null, null, tm, icc);
       mvccLockManager.startLockManager();
       lm = mvccLockManager;
+      contextFactory = new MVCCContextFactory();
+      icc.injectContextFactory(contextFactory);
    }
 
+   public void testFqnHashing()
+   {
+      LockContainer lc = (LockContainer) TestingUtil.extractField(lm, "lockContainer");
+      List<Fqn> fqns = new ArrayList<Fqn>();
+      fqns.add(Fqn.ROOT);
+      fqns.add(Fqn.fromString("/1"));
+      fqns.add(Fqn.fromString("/1/2"));
+      fqns.add(Fqn.fromString("/1/2/3"));
+      fqns.add(Fqn.fromString("/a/b/c/d"));
+
+      for (Fqn f : fqns) System.out.println("Fqn: " + f + "; hash = " + lc.hashToIndex(f));
+   }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/lock/NodeBasedLockManagerRecordingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/NodeBasedLockManagerRecordingTest.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/lock/NodeBasedLockManagerRecordingTest.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,5 +1,6 @@
 package org.jboss.cache.lock;
 
+import org.jboss.cache.factories.context.PessimisticContextFactory;
 import org.jboss.cache.invocation.InvocationContextContainer;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -16,6 +17,9 @@
    {
       icc = new InvocationContextContainer();
       lm = new NodeBasedLockManager();
+      PessimisticContextFactory pcf = new PessimisticContextFactory();
+      icc.injectContextFactory(pcf);
+      contextFactory = pcf;
       fqnBasedLocking = false;
    }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/MarshalledValueTest.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -3,9 +3,7 @@
 import org.jboss.cache.CacheException;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.util.TestingUtil;
 import org.jboss.cache.commands.write.PutDataMapCommand;
 import org.jboss.cache.commands.write.PutKeyValueCommand;
 import org.jboss.cache.config.CacheLoaderConfig;
@@ -15,10 +13,12 @@
 import org.jboss.cache.interceptors.MarshalledValueInterceptor;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
 import org.jboss.cache.invocation.CacheInvocationDelegate;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.loader.DummyInMemoryCacheLoader;
 import org.jboss.cache.notifications.annotation.CacheListener;
 import org.jboss.cache.notifications.annotation.NodeModified;
 import org.jboss.cache.notifications.event.NodeModifiedEvent;
+import org.jboss.cache.util.TestingUtil;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;

Modified: core/trunk/src/test/java/org/jboss/cache/notifications/NotifierTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/NotifierTest.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/NotifierTest.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,19 +1,20 @@
 package org.jboss.cache.notifications;
 
-import static org.easymock.EasyMock.*;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
+import static org.easymock.EasyMock.createNiceMock;
 import org.jboss.cache.Cache;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.buddyreplication.BuddyGroup;
+import org.jboss.cache.invocation.InvocationContext;
+import org.jboss.cache.invocation.LegacyInvocationContext;
 import org.jboss.cache.notifications.annotation.*;
 import org.jboss.cache.notifications.event.*;
 import org.jgroups.View;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 import javax.transaction.Transaction;
+import java.util.HashMap;
 import java.util.Map;
-import java.util.HashMap;
 
 /**
  * Tester class for {@link org.jboss.cache.notifications.NotifierImpl}.
@@ -35,7 +36,7 @@
    {
       cache = createNiceMock(Cache.class);
       notifier = new NotifierImpl(cache);
-      ctx = new InvocationContext();
+      ctx = new LegacyInvocationContext(null);
       allEventsListener = new AllEventsListener();
       notifier.addCacheListener(allEventsListener);
    }
@@ -211,7 +212,7 @@
 
    public void testNotifyCacheUnblocked()
    {
-      assert allEventsListener.cacheUnblockedEvent== null;
+      assert allEventsListener.cacheUnblockedEvent == null;
       notifier.notifyCacheUnblocked(false);
       assert allEventsListener.cacheUnblockedEvent != null;
       assert !allEventsListener.cacheUnblockedEvent.isPre();

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -8,14 +8,14 @@
 
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.util.TestingUtil;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
 import org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor;
 import org.jboss.cache.interceptors.TxInterceptor;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
+import org.jboss.cache.util.TestingUtil;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
@@ -294,7 +294,8 @@
       final String fastThreadName = "FAST";
       CommandInterceptor slowdownInterceptor = new CommandInterceptor()
       {
-         public Object hanldeDefault(InvocationContext ctx, VisitableCommand command) throws Throwable
+         @Override
+         public Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable
          {
             if (Thread.currentThread().getName().equals(slowThreadName) && ctx.getMethodCall().getMethodId() == OptimisticPrepareCommand.METHOD_ID)
             {

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/MockFailureInterceptor.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/MockFailureInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/MockFailureInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,9 +1,9 @@
 package org.jboss.cache.optimistic;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 
 import java.util.ArrayList;
 import java.util.List;

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/MockInterceptor.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/MockInterceptor.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/MockInterceptor.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,9 +1,9 @@
 package org.jboss.cache.optimistic;
 
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 
 import java.util.ArrayList;
 import java.util.List;

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticLockInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticLockInterceptorTest.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticLockInterceptorTest.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -2,16 +2,16 @@
 
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
-import org.jboss.cache.util.TestingUtil;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.interceptors.OptimisticInterceptor;
 import org.jboss.cache.interceptors.OptimisticLockingInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.lock.LockType;
 import static org.jboss.cache.lock.LockType.READ;
 import static org.jboss.cache.lock.LockType.WRITE;
 import org.jboss.cache.lock.NodeLock;
+import org.jboss.cache.util.TestingUtil;
 import org.testng.AssertJUnit;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -8,7 +8,6 @@
 
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.commands.tx.CommitCommand;
@@ -19,6 +18,7 @@
 import org.jboss.cache.interceptors.OptimisticNodeInterceptor;
 import org.jboss.cache.interceptors.OptimisticValidatorInterceptor;
 import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.loader.SamplePojo;
 import org.jboss.cache.transaction.GlobalTransaction;
 import org.jboss.cache.transaction.OptimisticTransactionContext;

Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -9,13 +9,13 @@
 import org.jboss.cache.Cache;
 import org.jboss.cache.DefaultCacheFactory;
 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.Configuration.CacheMode;
 import org.jboss.cache.config.Option;
 import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
 import org.jboss.cache.invocation.CacheInvocationDelegate;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.util.TestingUtil;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.AfterMethod;

Modified: core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java	2008-06-26 12:10:31 UTC (rev 6054)
+++ core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java	2008-06-26 14:18:49 UTC (rev 6055)
@@ -1,29 +1,29 @@
 package org.jboss.cache.util.internals;
 
 import org.jboss.cache.Cache;
+import org.jboss.cache.Fqn;
 import org.jboss.cache.RPCManager;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.Fqn;
 import org.jboss.cache.commands.ReplicableCommand;
 import org.jboss.cache.commands.remote.ReplicateCommand;
 import org.jboss.cache.commands.tx.PrepareCommand;
 import org.jboss.cache.factories.ComponentRegistry;
+import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.marshall.CommandAwareRpcDispatcher;
+import org.jboss.cache.marshall.InactiveRegionAwareRpcDispatcher;
 import org.jboss.cache.marshall.Marshaller;
 import org.jboss.cache.marshall.RegionalizedMethodCall;
-import org.jboss.cache.marshall.InactiveRegionAwareRpcDispatcher;
 import org.jboss.cache.util.TestingUtil;
 import org.jgroups.blocks.RpcDispatcher;
 
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
-import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
-import java.io.InputStream;
 
 /**
  * Utility class that notifies when certain commands were asynchronously replicated on secondary cache.




More information about the jbosscache-commits mailing list