[jbosscache-commits] JBoss Cache SVN: r6460 - in core/trunk/src: main/java/org/jboss/cache/commands/legacy and 12 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Thu Jul 31 07:07:46 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-07-31 07:07:45 -0400 (Thu, 31 Jul 2008)
New Revision: 6460

Removed:
   core/trunk/src/main/java/org/jboss/cache/registry/
Modified:
   core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java
   core/trunk/src/main/java/org/jboss/cache/LegacyRegionManagerImpl.java
   core/trunk/src/main/java/org/jboss/cache/NodeSPI.java
   core/trunk/src/main/java/org/jboss/cache/PessimisticNodeFactory.java
   core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java
   core/trunk/src/main/java/org/jboss/cache/VersionedNode.java
   core/trunk/src/main/java/org/jboss/cache/commands/legacy/ReversibleCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/legacy/read/LegacyGravitateDataCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/legacy/read/PessGetChildrenNamesCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/LegacyEvictCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessClearDataCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessCreateNodeCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessMoveCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessPutDataMapCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessPutForExternalReadCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessPutKeyValueCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessRemoveKeyCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessRemoveNodeCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/VersionedInvalidateCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java
   core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyActivationInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyCacheLoaderInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyPassivationInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.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/PessimisticLockInterceptor.java
   core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java
   core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java
   core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java
   core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeFactory.java
   core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java
   core/trunk/src/main/java/org/jboss/cache/mvcc/NullMarkerNode.java
   core/trunk/src/main/java/org/jboss/cache/mvcc/ReadCommittedNode.java
   core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java
   core/trunk/src/main/java/org/jboss/cache/optimistic/OptimisticNodeFactory.java
   core/trunk/src/main/java/org/jboss/cache/optimistic/TransactionWorkspace.java
   core/trunk/src/main/java/org/jboss/cache/optimistic/TransactionWorkspaceImpl.java
   core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNode.java
   core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java
   core/trunk/src/main/java/org/jboss/cache/transaction/OptimisticTransactionContext.java
   core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java
   core/trunk/src/main/java/org/jboss/cache/util/concurrent/SelfInitializingConcurrentHashMap.java
   core/trunk/src/test/java/org/jboss/cache/mock/NodeSpiMock.java
Log:
- Refactored and optimised MVCC codebase
- added deprecation to deprecated classes and components


Modified: core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -643,7 +643,7 @@
 
          NodeSPI childNode;
          Map children = n.getChildrenMapDirect();
-         childNode = children == null ? null : (NodeSPI) children.get(childName);
+         childNode = (NodeSPI) children.get(childName);
 
          if (childNode == null)
          {

Modified: core/trunk/src/main/java/org/jboss/cache/LegacyRegionManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/LegacyRegionManagerImpl.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/LegacyRegionManagerImpl.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -12,8 +12,10 @@
  *
  * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
  * @since 2.0.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
 @ThreadSafe
+ at Deprecated
 public class LegacyRegionManagerImpl extends RegionManagerImpl
 {
    /**

Modified: core/trunk/src/main/java/org/jboss/cache/NodeSPI.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/NodeSPI.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/NodeSPI.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -509,23 +509,20 @@
     * <p/>
     * Only used with MVCC.
     *
-    * @param ctx            invocation context
     * @param container      data container
-    * @param nodeFactory    node factory for creating new nodes/copies.
     * @param writeSkewCheck if true, and the node supports write skew checking, nodes are tested for write skews.
     */
-   void markForUpdate(InvocationContext ctx, DataContainer container, NodeFactory nodeFactory, boolean writeSkewCheck);
+   void markForUpdate(DataContainer container, boolean writeSkewCheck);
 
    /**
     * Commits any updates made on this node to the underlying data structure, making it visible to all other transactions.
     * <p/>
     * Only used with MVCC.
     *
-    * @param ctx         invocation context
-    * @param container   data container
-    * @param nodeFactory node factory
+    * @param ctx       invocation context
+    * @param container data container
     */
-   void commitUpdate(InvocationContext ctx, DataContainer container, NodeFactory nodeFactory);
+   void commitUpdate(InvocationContext ctx, DataContainer container);
 
    /**
     * Only used with MVCC.

Modified: core/trunk/src/main/java/org/jboss/cache/PessimisticNodeFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/PessimisticNodeFactory.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/PessimisticNodeFactory.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -10,7 +10,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @since 3.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class PessimisticNodeFactory<K, V> extends AbstractNodeFactory<K, V>
 {
    private LockStrategyFactory lockStrategyFactory;

Modified: core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -21,8 +21,10 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @since 3.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
 @SuppressWarnings("deprecation")
+ at Deprecated
 public class PessimisticUnversionedNode<K, V> extends UnversionedNode<K, V>
 {
    /**

Modified: core/trunk/src/main/java/org/jboss/cache/VersionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/VersionedNode.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/VersionedNode.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -23,7 +23,9 @@
  *
  * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  * @since 2.0.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class VersionedNode<K, V> extends PessimisticUnversionedNode<K, V>
 {
    private static final String DATA_VERSION_INTERNAL_KEY = "_JBOSS_INTERNAL_OPTIMISTIC_DATA_VERSION";

Modified: core/trunk/src/main/java/org/jboss/cache/commands/legacy/ReversibleCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/legacy/ReversibleCommand.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/commands/legacy/ReversibleCommand.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -7,7 +7,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @since 3.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public interface ReversibleCommand extends WriteCommand
 {
    /**

Modified: core/trunk/src/main/java/org/jboss/cache/commands/legacy/read/LegacyGravitateDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/legacy/read/LegacyGravitateDataCommand.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/commands/legacy/read/LegacyGravitateDataCommand.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -13,7 +13,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @since 3.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class LegacyGravitateDataCommand extends GravitateDataCommand
 {
    public LegacyGravitateDataCommand(Fqn fqn, boolean searchSubtrees, Address localAddress)

Modified: core/trunk/src/main/java/org/jboss/cache/commands/legacy/read/PessGetChildrenNamesCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/legacy/read/PessGetChildrenNamesCommand.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/commands/legacy/read/PessGetChildrenNamesCommand.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -12,6 +12,10 @@
 import java.util.Map;
 import java.util.Set;
 
+/**
+ * @deprecated will be removed along with optimistic and pessimistic locking.
+ */
+ at Deprecated
 public class PessGetChildrenNamesCommand extends GetChildrenNamesCommand
 {
    public PessGetChildrenNamesCommand()
@@ -36,7 +40,7 @@
       NodeSPI<?, ?> n = fqn == null ? null : ctx.lookUpNode(fqn);
       if (n == null || n.isDeleted()) return null;
       Map<Object, ? extends Node<?, ?>> childrenMap = n.getChildrenMapDirect();
-      Collection<NodeSPI<?, ?>> children = (Collection<NodeSPI<?, ?>>) ((childrenMap == null || childrenMap.isEmpty()) ? Collections.emptySet() : childrenMap.values());
+      Collection<NodeSPI<?, ?>> children = (Collection<NodeSPI<?, ?>>) (childrenMap.isEmpty() ? Collections.emptySet() : childrenMap.values());
 
       return getCorrectedChildNames(children, ctx);
    }

Modified: core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/LegacyEvictCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/LegacyEvictCommand.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/LegacyEvictCommand.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -12,7 +12,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @since 3.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class LegacyEvictCommand extends EvictCommand
 {
    public LegacyEvictCommand(Fqn fqn)

Modified: core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessClearDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessClearDataCommand.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessClearDataCommand.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -15,7 +15,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @since 3.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class PessClearDataCommand extends ClearDataCommand implements ReversibleCommand
 {
    private HashMap originalData;

Modified: core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessCreateNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessCreateNodeCommand.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessCreateNodeCommand.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -12,7 +12,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @since 3.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class PessCreateNodeCommand extends CreateNodeCommand implements ReversibleCommand
 {
    public PessCreateNodeCommand(Fqn fqn)

Modified: core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessMoveCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessMoveCommand.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessMoveCommand.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -13,7 +13,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @since 3.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class PessMoveCommand extends MoveCommand implements ReversibleCommand
 {
    public PessMoveCommand()

Modified: core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessPutDataMapCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessPutDataMapCommand.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessPutDataMapCommand.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -16,7 +16,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @since 3.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class PessPutDataMapCommand extends PutDataMapCommand implements ReversibleCommand
 {
    Map oldData;

Modified: core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessPutForExternalReadCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessPutForExternalReadCommand.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessPutForExternalReadCommand.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -14,7 +14,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @since 3.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class PessPutForExternalReadCommand extends PutForExternalReadCommand implements ReversibleCommand
 {
    protected Object oldValue;

Modified: core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessPutKeyValueCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessPutKeyValueCommand.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessPutKeyValueCommand.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -14,7 +14,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @since 3.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class PessPutKeyValueCommand extends PutKeyValueCommand implements ReversibleCommand
 {
    protected Object oldValue;

Modified: core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessRemoveKeyCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessRemoveKeyCommand.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessRemoveKeyCommand.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -13,7 +13,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @since 3.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class PessRemoveKeyCommand extends RemoveKeyCommand implements ReversibleCommand
 {
    /* internally used for rollback */

Modified: core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessRemoveNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessRemoveNodeCommand.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/PessRemoveNodeCommand.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -16,7 +16,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @since 3.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class PessRemoveNodeCommand extends RemoveNodeCommand implements ReversibleCommand
 {
    protected Map originalData;

Modified: core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/VersionedInvalidateCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/VersionedInvalidateCommand.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/commands/legacy/write/VersionedInvalidateCommand.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -27,7 +27,9 @@
  *
  * @author Mircea.Markus at jboss.com
  * @since 2.2
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class VersionedInvalidateCommand extends InvalidateCommand implements VersionedDataCommand
 {
    private static final Log log = LogFactory.getLog(VersionedInvalidateCommand.class);

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-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -51,7 +51,7 @@
       ReadCommittedNode n = (ReadCommittedNode) (fqn == null ? null : ctx.lookUpNode(fqn));
       if (n == null || n.isDeleted()) return null;
       Map<Object, InternalNode<?, ?>> childrenMap = n.getDelegationTarget().getChildrenMap();
-      Collection<InternalNode> children = (Collection<InternalNode>) ((childrenMap == null || childrenMap.isEmpty()) ? Collections.emptySet() : childrenMap.values());
+      Collection<InternalNode> children = (Collection<InternalNode>) (childrenMap.isEmpty() ? Collections.emptySet() : childrenMap.values());
 
       return getCorrectedChildNames(children, ctx);
    }

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-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -96,12 +96,13 @@
       return null;
    }
 
+   @SuppressWarnings("unchecked")
    private void moveRecursively(NodeSPI oldNode, NodeSPI newNode, InvocationContext ctx)
    {
       if (trace) log.trace("Moving " + oldNode.getFqn() + " to " + newNode.getFqn());
       // start deep.
       Map<Object, InternalNode> children = oldNode.getDelegationTarget().getChildrenMap();
-      if (children != null && !children.isEmpty())
+      if (!children.isEmpty())
       {
          for (InternalNode child : children.values())
          {

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyActivationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyActivationInterceptor.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyActivationInterceptor.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -39,7 +39,9 @@
  *
  * @author <a href="mailto:{hmesha at novell.com}">{Hany Mesha}</a>
  * @version $Id$
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class LegacyActivationInterceptor extends LegacyCacheLoaderInterceptor implements ActivationInterceptorMBean
 {
 

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyCacheLoaderInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyCacheLoaderInterceptor.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyCacheLoaderInterceptor.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -46,7 +46,9 @@
  *
  * @author Bela Ban
  * @version $Id$
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class LegacyCacheLoaderInterceptor extends CommandInterceptor implements CacheLoaderInterceptorMBean
 {
    private long cacheLoads = 0;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyPassivationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyPassivationInterceptor.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyPassivationInterceptor.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -13,7 +13,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @since 3.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class LegacyPassivationInterceptor extends PassivationInterceptor
 {
    private DataContainer dataContainer;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -3,7 +3,6 @@
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InternalNode;
-import org.jboss.cache.NodeFactory;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.commands.VisitableCommand;
 import org.jboss.cache.commands.read.ExistsCommand;
@@ -49,15 +48,13 @@
 {
    LockManager lockManager;
    DataContainer dataContainer;
-   NodeFactory nodeFactory;
    MVCCNodeHelper helper;
 
    @Inject
-   public void setDependencies(LockManager lockManager, DataContainer dataContainer, NodeFactory nodeFactory, MVCCNodeHelper helper)
+   public void setDependencies(LockManager lockManager, DataContainer dataContainer, MVCCNodeHelper helper)
    {
       this.lockManager = lockManager;
       this.dataContainer = dataContainer;
-      this.nodeFactory = nodeFactory;
       this.helper = helper;
    }
 
@@ -95,7 +92,7 @@
    @Override
    public Object handleRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand command) throws Throwable
    {
-      helper.wrapNodesForWriting(ctx, command.getFqn());
+      helper.wrapNodesRecursivelyForRemoval(ctx, command.getFqn());
       return invokeNextInterceptor(ctx, command);
    }
 
@@ -129,13 +126,14 @@
       List<Fqn> fqnsToEvict;
       if (command.getFqn().isRoot())
       {
-         // special treatment - deal with all of root's kids instead.
+         // if this is the root node, do not attempt to lock this for writing but instead just get all direct children of root.
          Map<Object, InternalNode> children = dataContainer.peekInternalNode(Fqn.ROOT, false).getChildrenMap();
-         if (children != null && !children.isEmpty())
+         if (!children.isEmpty())
          {
             fqnsToEvict = new LinkedList<Fqn>();
+            // lock recursively.
             for (InternalNode child : children.values())
-               fqnsToEvict.addAll(helper.wrapNodesForWriting(ctx, child.getFqn()));
+               fqnsToEvict.addAll(helper.wrapNodesRecursivelyForRemoval(ctx, child.getFqn()));
          }
          else
          {
@@ -144,9 +142,11 @@
       }
       else
       {
-         fqnsToEvict = helper.wrapNodesForWriting(ctx, command.getFqn());
+         // lock current node recursively.
+         fqnsToEvict = helper.wrapNodesRecursivelyForRemoval(ctx, command.getFqn());
       }
 
+      // set these in the evict command so that the command is aware of what needs to be evicted.
       command.setNodesToEvict(fqnsToEvict);
    }
 
@@ -155,8 +155,9 @@
    {
       if (command.getFqn().isRoot())
       {
+         // if this is the root node, do not attempt to lock this for writing but instead just get all direct children of root.
          Map<Object, NodeSPI> children = dataContainer.peekInternalNode(Fqn.ROOT, false).getChildrenMap();
-         if (children != null && !children.isEmpty())
+         if (!children.isEmpty())
          {
             for (NodeSPI child : children.values())
                helper.wrapNodeForWriting(ctx, child.getFqn(), true, false, false, true, true);
@@ -164,6 +165,7 @@
       }
       else
       {
+         // just wrap the node for writing.  Do not create if absent.
          helper.wrapNodeForWriting(ctx, command.getFqn(), true, false, false, true, true);
       }
    }
@@ -173,7 +175,7 @@
    {
       // this should be handled the same as a recursive evict command.
       ctx.getOptionOverrides().setLockAcquisitionTimeout(0);
-      if (!command.getFqn().isRoot()) helper.wrapNodesForWriting(ctx, command.getFqn());
+      if (!command.getFqn().isRoot()) helper.wrapNodesRecursivelyForRemoval(ctx, command.getFqn());
       return invokeNextInterceptor(ctx, command);
    }
 
@@ -229,20 +231,21 @@
    @Override
    public Object handleMoveCommand(InvocationContext ctx, MoveCommand command) throws Throwable
    {
-      // nodes we need to get WLs for:
-      // node we are moving FROM (and it's parent and children.)  Same as removeNode.
-      List<Fqn> nodeAndChildren = helper.wrapNodesForWriting(ctx, command.getFqn());
+      // Nodes we need to get WLs for:
 
+      // 1) node we are moving FROM, and it's parent and ALL children.  Same as removeNode.
+      List<Fqn> nodeAndChildren = helper.wrapNodesRecursivelyForRemoval(ctx, command.getFqn());
+
       Fqn newParent = command.getTo();
       Fqn oldParent = command.getFqn().getParent();
 
-      // now lock the new parent.
+      // 2)  The new parent.
       helper.wrapNodeForWriting(ctx, newParent, true, true, false, false, false);
 
-      if (!oldParent.equals(newParent) && nodeAndChildren != null)
+      if (!oldParent.equals(newParent))
       {
          // the nodeAndChildren list contains all child nodes, including the node itself.
-         // now obtain locks on the new places these new nodes will occupy.
+         // 3)  now obtain locks on the new places these new nodes will occupy.
          for (Fqn f : nodeAndChildren)
          {
             Fqn newChildFqn = f.replaceAncestor(oldParent, newParent);
@@ -313,6 +316,7 @@
       return retval;
    }
 
+   @SuppressWarnings("unchecked")
    protected void doAfterCall(InvocationContext ctx, VisitableCommand command)
    {
       // for non-transactional stuff.
@@ -321,21 +325,7 @@
          List<Fqn> locks;
          if (!(locks = ctx.getLocks()).isEmpty())
          {
-            // clean up.
-            // unlocking needs to be done in reverse order.
-            ListIterator<Fqn> it = locks.listIterator(locks.size());
-            Object owner = Thread.currentThread();
-            while (it.hasPrevious())
-            {
-               Fqn f = it.previous();
-               // for each of these, swap refs
-               NodeSPI rcn = ctx.lookUpNode(f);
-               if (rcn != null) rcn.commitUpdate(ctx, dataContainer, nodeFactory); // could be null with read-committed
-               // and then unlock
-               if (trace) log.trace("Releasing lock on [" + f + "] for thread " + owner);
-               lockManager.unlock(f, owner);
-            }
-            ctx.clearLocks();
+            cleanupLocks(locks, ctx, Thread.currentThread(), true);
          }
          else
          {
@@ -344,47 +334,55 @@
       }
       else
       {
-         if (trace)
-            log.trace("Nothing to do since there is a transaction in scope.");
+         if (trace) log.trace("Nothing to do since there is a transaction in scope.");
       }
    }
 
-   protected void transactionalCleanup(boolean commit, InvocationContext ctx)
+   private void cleanupLocks(List<Fqn> locks, InvocationContext ctx, Object owner, boolean commit)
    {
-      if (ctx.getTransactionContext() != null)
+      // clean up.
+      // unlocking needs to be done in reverse order.
+      ListIterator<Fqn> it = locks.listIterator(locks.size());
+
+      if (commit)
       {
-         List<Fqn> locks;
-         if (!(locks = ctx.getTransactionContext().getLocks()).isEmpty())
+         while (it.hasPrevious())
          {
-            // clean up.
-            // unlocking needs to be done in reverse order.
-            ListIterator<Fqn> it = locks.listIterator(locks.size());
-            Object owner = ctx.getGlobalTransaction();
-            while (it.hasPrevious())
-            {
-               Fqn f = it.previous();
-               NodeSPI rcn = ctx.lookUpNode(f);
-               if (rcn != null) // could be null with read-committed
-               {
-                  if (commit)
-                  {
-                     // for each of these, swap refs
-                     rcn.commitUpdate(ctx, dataContainer, nodeFactory);
-                  }
-                  else
-                  {
-                     rcn.rollbackUpdate();
-                  }
-               }
-               // and then unlock
-               if (trace) log.trace("Releasing lock on [" + f + "] for transaction " + owner);
-               lockManager.unlock(f, owner);
-            }
-            ctx.clearLocks();
+            Fqn f = it.previous();
+            NodeSPI rcn = ctx.lookUpNode(f);
+            // could be null with read-committed
+            if (rcn != null) rcn.commitUpdate(ctx, dataContainer);
+            // and then unlock
+            if (trace) log.trace("Releasing lock on [" + f + "] for owner " + owner);
+            lockManager.unlock(f, owner);
          }
       }
       else
       {
+         while (it.hasPrevious())
+         {
+            Fqn f = it.previous();
+            NodeSPI rcn = ctx.lookUpNode(f);
+            // could be null with read-committed
+            if (rcn != null) rcn.rollbackUpdate();
+            // and then unlock
+            if (trace) log.trace("Releasing lock on [" + f + "] for owner " + owner);
+            lockManager.unlock(f, owner);
+         }
+      }
+      ctx.clearLocks();
+   }
+
+   @SuppressWarnings("unchecked")
+   private void transactionalCleanup(boolean commit, InvocationContext ctx)
+   {
+      if (ctx.getTransactionContext() != null)
+      {
+         List<Fqn> locks = ctx.getTransactionContext().getLocks();
+         if (!locks.isEmpty()) cleanupLocks(locks, ctx, ctx.getGlobalTransaction(), commit);
+      }
+      else
+      {
          throw new IllegalStateException("Attempting to do a commit or rollback but there is no transactional context in scope. " + ctx);
       }
    }

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -37,7 +37,9 @@
  *
  * @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>
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class OptimisticCreateIfNotExistsInterceptor extends OptimisticInterceptor
 {
    /**

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -30,7 +30,9 @@
  * Abstract interceptor for optimistic locking
  *
  * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public abstract class OptimisticInterceptor extends CommandInterceptor
 {
    protected TransactionManager txManager;

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -27,7 +27,9 @@
  *
  * @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>
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class OptimisticLockingInterceptor extends OptimisticInterceptor
 {
    @Start

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -49,7 +49,9 @@
  *
  * @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>
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class OptimisticNodeInterceptor extends OptimisticInterceptor
 {
    /**

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -50,7 +50,9 @@
  *
  * @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>
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class OptimisticReplicationInterceptor extends BaseRpcInterceptor
 {
    /**

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticTxInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticTxInterceptor.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticTxInterceptor.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -24,7 +24,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @since 2.2.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class OptimisticTxInterceptor extends TxInterceptor
 {
    protected final ModificationsReplayVisitor replayVisitor = new ModificationsReplayVisitor();

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -45,7 +45,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @author Steve Woodcock (<a href="mailto:stevew at jofti.com">stevew at jofti.com</a>)
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class OptimisticValidatorInterceptor extends OptimisticInterceptor
 {
    private boolean useTombstones;
@@ -139,6 +141,7 @@
       return invokeNextInterceptor(ctx, command);
    }
 
+   @SuppressWarnings("unchecked")
    private void commitTransaction(InvocationContext ctx)
    {
       GlobalTransaction gtx = getGlobalTransaction(ctx);
@@ -194,14 +197,11 @@
                {
                   // mark it as invalid so any direct references are marked as such
                   Map childNode = underlyingNode.getChildrenMapDirect();
-                  if (childNode != null)
+                  for (Object o : childNode.values())
                   {
-                     for (Object o : childNode.values())
-                     {
-                        NodeSPI cn = (NodeSPI) o;
-                        cn.setValid(false, true);
-                        if (!useTombstones) underlyingNode.removeChildDirect(cn.getFqn().getLastElement());
-                     }
+                     NodeSPI cn = (NodeSPI) o;
+                     cn.setValid(false, true);
+                     if (!useTombstones) underlyingNode.removeChildDirect(cn.getFqn().getLastElement());
                   }
                }
 

Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -55,7 +55,9 @@
  *
  * @author Bela Ban
  * @version $Id$
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class PessimisticLockInterceptor extends PrePostProcessingCommandInterceptor
 {
    private DataContainer dataContainer;
@@ -289,6 +291,7 @@
     * @param transactionContext transaction entry
     * @throws InterruptedException in the event of interruption
     */
+   @SuppressWarnings("unchecked")
    public void lockAllForRemoval(NodeSPI node, InvocationContext ctx, TransactionContext transactionContext) throws InterruptedException
    {
       if (node == null) return;
@@ -300,13 +303,10 @@
 
       // now children.
       Map<Object, NodeSPI> children = node.getChildrenMapDirect();
-      if (children != null)
+      for (NodeSPI child : children.values())
       {
-         for (NodeSPI child : children.values())
-         {
-            // lock child.
-            lockAllForRemoval(child, ctx, transactionContext);
-         }
+         // lock child.
+         lockAllForRemoval(child, ctx, transactionContext);
       }
    }
 

Modified: core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -11,7 +11,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @since 3.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class LegacyInvocationContext extends AbstractInvocationContext
 {
    DataContainer container;

Modified: core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -8,7 +8,6 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InternalNode;
 import org.jboss.cache.Node;
-import org.jboss.cache.NodeFactory;
 import org.jboss.cache.NodeNotValidException;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.config.Option;
@@ -525,12 +524,12 @@
       throw new UnsupportedOperationException();
    }
 
-   public void markForUpdate(InvocationContext ctx, DataContainer container, NodeFactory nodeFactory, boolean writeSkewCheck)
+   public void markForUpdate(DataContainer container, boolean writeSkewCheck)
    {
       throw new UnsupportedOperationException();
    }
 
-   public void commitUpdate(InvocationContext ctx, DataContainer container, NodeFactory nodeFactory)
+   public void commitUpdate(InvocationContext ctx, DataContainer container)
    {
       throw new UnsupportedOperationException();
    }

Modified: core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -136,6 +136,7 @@
       }
    }
 
+   @SuppressWarnings("unchecked")
    private boolean lockRecursively(InternalNode node, long timeoutMillis, boolean excludeInternalFqns, InvocationContext ctx) throws InterruptedException
    {
       if (excludeInternalFqns && internalFqns.contains(node.getFqn()))
@@ -150,7 +151,6 @@
 
       // need to recursively walk through the node's children and acquire locks.  This needs to happen using API methods
       // since any cache loading will need to happen.
-      //Set<InternalNode> children = node.getChildren();
       Map<Object, InternalNode> children = node.getChildrenMap();
       try
       {

Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeFactory.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeFactory.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -49,6 +49,7 @@
     * @return a ReadCommittedNode
     */
    @Override
+   @SuppressWarnings("unchecked")
    public ReadCommittedNode createWrappedNode(InternalNode<K, V> node)
    {
       if (node == null) return useRepeatableRead ? NULL_MARKER : null;
@@ -58,36 +59,20 @@
       return rcn;
    }
 
-//   private NodeSPI<K, V> initializeNodeInvocationDelegate(UnversionedNode<K, V> internal)
-//   {
-//      internal.injectDependencies(cache, commandsFactory, this);
-//
-//      // always assume that new nodes do not have data loaded
-//      internal.setDataLoaded(false);
-//      NodeSPI<K, V> nid = createNodeInvocationDelegate(internal, !useRepeatableRead);
-//
-//      // back reference
-//      internal.setDelegate(nid);
-//      return nid;
-//   }
-
    @Override
    public NodeSPI<K, V> createNode(Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data)
    {
-//      UnversionedNode<K, V> internal = new UnversionedNode<K, V>(fqn, cache, lockChildForInsertRemove, data);
-//      return initializeNodeInvocationDelegate(internal);
       throw new UnsupportedOperationException();
    }
 
    @Override
    public NodeSPI<K, V> createNode(Fqn fqn, NodeSPI<K, V> parent)
    {
-//      UnversionedNode<K, V> internal = new UnversionedNode<K, V>(fqn, cache, lockChildForInsertRemove);
-//      return initializeNodeInvocationDelegate(internal);
       throw new UnsupportedOperationException();
    }
 
    @Override
+   @SuppressWarnings("unchecked")
    public NodeSPI<K, V> createRootNode()
    {
       return createWrappedNode(createInternalNode(Fqn.ROOT));
@@ -112,18 +97,8 @@
       return createNode(Fqn.fromRelativeElements(parent.getFqn(), childName), parent);
    }
 
-//   @Override
-//   protected NodeSPI<K, V> createNodeInvocationDelegate(InternalNode<K, V> internalNode, boolean wrapWithNodeReference)
-//   {
-//      if (wrapWithNodeReference && internalNode instanceof NodeReference)
-//         throw new IllegalArgumentException("Cannot wrap a NodeReference with a NodeReference!");
-//      if (wrapWithNodeReference && useRepeatableRead)
-//         throw new IllegalArgumentException("Cannot use NodeReferences with RepeatableRead!");
-//      if (wrapWithNodeReference) internalNode = new NodeReference<K, V>(internalNode);
-//      return super.createNodeInvocationDelegate(internalNode, false);
-//   }
-
    @Override
+   @SuppressWarnings("unchecked")
    public InternalNode<K, V> createAndRegister(Fqn fqn, InternalNode<K, V> parent, InvocationContext ctx, boolean attachToParent)
    {
       InternalNode<K, V> child;
@@ -141,7 +116,7 @@
 
          if (trace) log.trace("Created new child with fqn [" + fqn + "]");
 
-         TransactionContext tctx = null;
+         TransactionContext tctx;
          if ((tctx = ctx.getTransactionContext()) != null)
          {
             CreateNodeCommand createNodeCommand = commandsFactory.buildCreateNodeCommand(fqn);

Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -7,6 +7,7 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InternalNode;
 import org.jboss.cache.NodeFactory;
+import org.jboss.cache.NodeNotExistsException;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.annotations.Inject;
@@ -18,6 +19,7 @@
 import org.jboss.cache.lock.TimeoutException;
 
 import java.util.Collection;
+import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -98,6 +100,7 @@
       return wrapNodeForReading(ctx, fqn, ctx.getOptionOverrides().isForceWriteLock());
    }
 
+   @SuppressWarnings("unchecked")
    private NodeSPI wrapNodeForReading(InvocationContext ctx, Fqn f, boolean writeLockForced) throws InterruptedException
    {
       NodeSPI n;
@@ -156,6 +159,7 @@
     * data structure.  It will lock the node, and potentially the parent as well, if necessary.  If the parent is locked,
     * it too will be added to the context if it wasn't there already.
     *
+    * @param context             invocation context
     * @param fqn                 to retrieve
     * @param lockForWriting      if true, a lock will be acquired.
     * @param createIfAbsent      if true, will be created if absent.
@@ -163,7 +167,9 @@
     * @param forRemoval          if true, the parent may also be locked if locking parents for removal is necessary.
     * @param force               if true, will force the write lock even if the node is null.
     * @return a wrapped node, or null.
+    * @throws InterruptedException if interrupted
     */
+   @SuppressWarnings("unchecked")
    public NodeSPI wrapNodeForWriting(InvocationContext context, Fqn fqn, boolean lockForWriting, boolean createIfAbsent, boolean includeInvalidNodes, boolean forRemoval, boolean force) throws InterruptedException
    {
       Fqn parentFqn = null;
@@ -175,7 +181,7 @@
          if (lockForWriting && acquireLock(context, fqn))
          {
             // create a copy of the underlying node
-            n.markForUpdate(context, dataContainer, nodeFactory, writeSkewCheck);
+            n.markForUpdate(dataContainer, writeSkewCheck);
          }
          if (trace) log.trace("Retrieving wrapped node " + fqn);
          if (n.isDeleted() && createIfAbsent)
@@ -200,7 +206,7 @@
             }
             n = nodeFactory.createWrappedNode(in);
             context.putLookedUpNode(fqn, n);
-            if (needToCopy) n.markForUpdate(context, dataContainer, nodeFactory, writeSkewCheck);
+            if (needToCopy) n.markForUpdate(dataContainer, writeSkewCheck);
          }
          else if (createIfAbsent) // else, do we need to create one?
          {
@@ -212,21 +218,17 @@
             if (parentLockNeeded && acquireLock(context, parentFqn))
             {
                ReadCommittedNode parentRCN = (ReadCommittedNode) context.lookUpNode(parentFqn);
-               parentRCN.markForUpdate(context, dataContainer, nodeFactory, writeSkewCheck);
+               parentRCN.markForUpdate(dataContainer, writeSkewCheck);
             }
 
             // now to lock and create the node.  Lock first to prevent concurrent creation!
             acquireLock(context, fqn);
             in = nodeFactory.createAndRegister(fqn, null, context, false);
 
-//            NodeSPI temp = parent.getOrCreateChild(fqn.getLastElement(), context.getGlobalTransaction());
-//            parent.removeChildDirect(fqn.getLastElement());
-//            in = ((NodeInvocationDelegate) temp).getDelegationTarget();
-
             n = nodeFactory.createWrappedNode(in);
             n.setCreated(true);
             context.putLookedUpNode(fqn, n);
-            n.markForUpdate(context, dataContainer, nodeFactory, writeSkewCheck);
+            n.markForUpdate(dataContainer, writeSkewCheck);
          }
       }
 
@@ -241,6 +243,50 @@
    }
 
    /**
+    * The same as {@link #wrapNodeForWriting(org.jboss.cache.invocation.InvocationContext, org.jboss.cache.Fqn, boolean, boolean, boolean, boolean, boolean)}
+    * except that it takes in an {@link org.jboss.cache.InternalNode} instead of a {@link Fqn}.  Saves on a lookup.
+    * <p/>
+    * Also assumes that the node exists, and hence will not be created.
+    * <p/>
+    *
+    * @param context invocation context
+    * @param node    node to wrap
+    * @return a wrapped node, or null.
+    * @throws InterruptedException if interrupted
+    */
+   @SuppressWarnings("unchecked")
+   public NodeSPI wrapNodeForWriting(InvocationContext context, InternalNode node) throws InterruptedException
+   {
+      Fqn fqn = node.getFqn();
+      NodeSPI n = context.lookUpNode(fqn);
+      if (n != null) // exists in context!  Just acquire lock if needed, and wrap.
+      {
+         // acquire lock if needed
+         if (acquireLock(context, fqn))
+         {
+            // create a copy of the underlying node
+            n.markForUpdate(dataContainer, writeSkewCheck);
+         }
+         if (trace) log.trace("Retrieving wrapped node " + fqn);
+      }
+      else
+      {
+         // exists in cache!  Just acquire lock if needed, and wrap.
+         // do we need a lock?
+         boolean needToCopy = false;
+         if (acquireLock(context, fqn))
+         {
+            needToCopy = true;
+         }
+         n = nodeFactory.createWrappedNode(node);
+         context.putLookedUpNode(fqn, n);
+         if (needToCopy) n.markForUpdate(dataContainer, writeSkewCheck);
+      }
+
+      return n;
+   }
+
+   /**
     * Wraps a node and all its subnodes and adds them to the context, acquiring write locks for them all.
     *
     * @param ctx context
@@ -248,7 +294,8 @@
     * @return a list of Fqns of locks acquired in this call.
     * @throws InterruptedException if the lock manager is interrupted.
     */
-   public List<Fqn> wrapNodesForWriting(InvocationContext ctx, Fqn fqn) throws InterruptedException
+   @SuppressWarnings("unchecked")
+   public List<Fqn> wrapNodesRecursivelyForRemoval(InvocationContext ctx, Fqn fqn) throws InterruptedException
    {
       // when removing a node we want to get a lock on the Fqn anyway and return the wrapped node.
       if (fqn.isRoot()) throw new CacheException("Attempting to remove Fqn.ROOT!");
@@ -257,49 +304,57 @@
       // inspect parent
       boolean needToCopyParent = false;
       boolean parentLockNeeded = isParentLockNeeded(parentFqn, ctx);
+      ReadCommittedNode parent = null;
       if (parentLockNeeded)
       {
          needToCopyParent = acquireLock(ctx, parentFqn);
          // Ensure the node is in the context.
-         putNodeInContext(ctx, parentFqn, needToCopyParent);
+         parent = wrapAndPutInContext(ctx, parentFqn, needToCopyParent);
       }
 
       boolean needToCopyNode = acquireLock(ctx, fqn);
 
       // Ensure the node is in the context.
-      putNodeInContext(ctx, fqn, needToCopyNode);
+      ReadCommittedNode node = wrapAndPutInContext(ctx, fqn, needToCopyNode);
 
-      ReadCommittedNode node = (ReadCommittedNode) ctx.lookUpNode(fqn);
-
-      // update child ref on parent to point to child as this is now a copy.
-      if (node != null && !(node.isNullNode()))
+      if (node == null || node.isNullNode())
       {
+         // node does not exist; return an empty list since there is nothing to remove!
+         return Collections.emptyList();
+      }
+      else
+      {
+         // update child ref on parent to point to child as this is now a copy.
          if (parentLockNeeded && (needToCopyNode || needToCopyParent))
          {
-            ReadCommittedNode parent = (ReadCommittedNode) ctx.lookUpNode(parentFqn);
+            if (parent == null) throw new NodeNotExistsException("Parent node " + parentFqn + " does not exist!");
             parent.getDelegationTarget().addChild(node.getDelegationTarget());
-
-//            parent.addChildDirect(nodeFactory.createNodeInvocationDelegate(node.getDelegationTarget(), configuration.getIsolationLevel() == IsolationLevel.READ_COMMITTED));
          }
 
          // now deal with children.
-//         Map childMap = node.getChildrenMapDirect();
          Map<Object, InternalNode<?, ?>> childMap = node.getDelegationTarget().getChildrenMap();
          List<Fqn> fqnsToBeRemoved = new LinkedList<Fqn>();
          fqnsToBeRemoved.add(fqn);
-         if (childMap == null || childMap.isEmpty()) return fqnsToBeRemoved;
 
-         for (InternalNode n : childMap.values())
+         if (!childMap.isEmpty())
          {
-            lockForWritingRecursive(n.getFqn(), ctx, fqnsToBeRemoved);
+            for (InternalNode n : childMap.values()) lockForWritingRecursive(n.getFqn(), ctx, fqnsToBeRemoved);
          }
 
          return fqnsToBeRemoved;
       }
-
-      return null;
    }
 
+   /**
+    * Locks a node recursively for writing, not creating if it doesn't exist.
+    *
+    * @param fqn     Fqn to lock
+    * @param ctx     invocation context to add wrapped node to
+    * @param fqnList fqnList to update - this list should not be null but should be initially empty and will be populated
+    *                with a list of all Fqns locked in this call.
+    * @throws InterruptedException if interrupted
+    */
+   @SuppressWarnings("unchecked")
    private void lockForWritingRecursive(Fqn fqn, InvocationContext ctx, List<Fqn> fqnList) throws InterruptedException
    {
       acquireLock(ctx, fqn); // lock node
@@ -309,30 +364,51 @@
       NodeSPI rcn = wrapNodeForWriting(ctx, fqn, true, false, true, false, false);
       if (rcn != null)
       {
-         rcn.markForUpdate(ctx, dataContainer, nodeFactory, writeSkewCheck);
+         rcn.markForUpdate(dataContainer, writeSkewCheck);
+         Map<Object, InternalNode<?, ?>> children = rcn.getDelegationTarget().getChildrenMap();
+         for (InternalNode child : children.values()) lockForWritingRecursive(child, ctx, fqnList);
+      }
+   }
 
-         // Why is this necessary again?!?? - Manik, 24Jul08
+   /**
+    * Identical to {@link #lockForWritingRecursive(org.jboss.cache.Fqn, org.jboss.cache.invocation.InvocationContext, java.util.List)}
+    * except that it uses an {@link org.jboss.cache.InternalNode} instead of an {@link Fqn} - saves a lookup.
+    *
+    * @param node    node to lock recursively
+    * @param ctx     invocation context
+    * @param fqnList list of Fqns to add to
+    * @throws InterruptedException if interrupted
+    */
+   @SuppressWarnings("unchecked")
+   private void lockForWritingRecursive(InternalNode node, InvocationContext ctx, List<Fqn> fqnList) throws InterruptedException
+   {
+      Fqn fqn = node.getFqn();
+      acquireLock(ctx, fqn); // lock node
+      if (fqnList != null) fqnList.add(fqn);
 
-//         NodeSPI parent = ctx.lookUpNode(fqn.getParent());
-//         parent.getDelegationTarget().addChild(rcn.getDelegationTarget());
-
-         // yukky logic.
-
-//         parent.addChildDirect(nodeFactory.createNodeInvocationDelegate(rcn.getDelegationTarget(), configuration.getIsolationLevel() == IsolationLevel.READ_COMMITTED));
-
-//         Map<Object, NodeSPI> children = rcn.getChildrenMapDirect();
+      // now wrap and add to the context
+      NodeSPI rcn = wrapNodeForWriting(ctx, node);
+      if (rcn != null)
+      {
+         rcn.markForUpdate(dataContainer, writeSkewCheck);
          Map<Object, InternalNode<?, ?>> children = rcn.getDelegationTarget().getChildrenMap();
-         if (children != null)
-         {
-            for (InternalNode child : children.values())
-            {
-               lockForWritingRecursive(child.getFqn(), ctx, fqnList);
-            }
-         }
+         for (InternalNode child : children.values()) lockForWritingRecursive(child, ctx, fqnList);
       }
    }
 
-   private void putNodeInContext(InvocationContext ctx, Fqn fqn, boolean needToCopyNode)
+
+   /**
+    * Wraps a node and puts it in the context, optionally copying the node for updating if <tt>forUpdate</tt> is <tt>true</tt>.
+    * If the node is already in the context, a new wrapped node is not created, but the existing one is still checked
+    * for changes and potentially marked for update if <tt>forUpdate</tt> is <tt>true</tt>.
+    *
+    * @param ctx       invocation context to add node to
+    * @param fqn       fqn of node to add
+    * @param forUpdate if true, the wrapped node is marked for update before adding to the context.
+    * @return the ReadCommittedNode wrapper, or null if the node does not exist.
+    */
+   @SuppressWarnings("unchecked")
+   private ReadCommittedNode wrapAndPutInContext(InvocationContext ctx, Fqn fqn, boolean forUpdate)
    {
       ReadCommittedNode node = (ReadCommittedNode) ctx.lookUpNode(fqn);
       if (node == null)
@@ -342,17 +418,31 @@
          ctx.putLookedUpNode(fqn, node);
       }
 
-      if (needToCopyNode && node != null && !node.isChanged()) // node could be null if using read-committed
-      {
-         node.markForUpdate(ctx, dataContainer, nodeFactory, writeSkewCheck);
-      }
+      // node could be null if using read-committed
+      if (forUpdate && node != null && !node.isChanged()) node.markForUpdate(dataContainer, writeSkewCheck);
+
+      return node;
    }
 
+   /**
+    * An overloaded version of {@link #isParentLockNeeded(org.jboss.cache.Fqn, org.jboss.cache.invocation.InvocationContext)}
+    * which takes in an {@link org.jboss.cache.InternalNode} instead of a {@link Fqn}.
+    *
+    * @param parent parent node to test
+    * @return true if parent lock is needed, false otherwise.
+    */
    private boolean isParentLockNeeded(InternalNode parent)
    {
       return lockParentForChildInsertRemove || (parent != null && parent.isLockForChildInsertRemove());
    }
 
+   /**
+    * Tests if locking the parent is necessary when locking a specific node.
+    *
+    * @param parent Fqn of parent node to check
+    * @param ctx    invocation context
+    * @return true if parent lock is needed, false otherwise.
+    */
    private boolean isParentLockNeeded(Fqn parent, InvocationContext ctx)
    {
       ReadCommittedNode parentNodeTmp = (ReadCommittedNode) ctx.lookUpNode(parent);

Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/NullMarkerNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/NullMarkerNode.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/NullMarkerNode.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -2,8 +2,6 @@
 
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.InternalNode;
-import org.jboss.cache.NodeFactory;
-import org.jboss.cache.invocation.InvocationContext;
 
 /**
  * A marker node to represent a null node for repeatable read, so that a read that returns a null can continue to return
@@ -50,7 +48,7 @@
     * A no-op.
     */
    @Override
-   public void markForUpdate(InvocationContext ctx, DataContainer d, NodeFactory nodeFactory, boolean b)
+   public void markForUpdate(DataContainer d, boolean b)
    {
       // no op
    }

Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/ReadCommittedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/ReadCommittedNode.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/ReadCommittedNode.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -5,7 +5,6 @@
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InternalNode;
-import org.jboss.cache.NodeFactory;
 import org.jboss.cache.NodeNotExistsException;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.invocation.InvocationContext;
@@ -37,6 +36,7 @@
       }
    }
 
+   @SuppressWarnings("unchecked")
    public ReadCommittedNode(InternalNode node)
    {
       super(node);
@@ -80,22 +80,25 @@
    }
 
    @Override
-   public void markForUpdate(InvocationContext ctx, DataContainer container, NodeFactory nodeFactory, boolean writeSkewCheck)
+   public void markForUpdate(DataContainer container, boolean writeSkewCheck)
    {
       if (isFlagSet(CHANGED)) return; // already copied
 
-      setFlag(CHANGED);
-      if (!isFlagSet(CREATED))
+      setFlag(CHANGED);  // mark as changed
+      if (!isFlagSet(CREATED)) // if newly created, then nothing to copy.
       {
          backup = node;
+         // don't copy the NodeReference but the InternalNode that the NodeReference delegates to.
          InternalNode backupDelegationTarget = ((NodeReference) backup).getDelegate();
          node = backupDelegationTarget.copy();
       }
    }
 
    @Override
-   public void commitUpdate(InvocationContext ctx, DataContainer container, NodeFactory nodeFactory)
+   @SuppressWarnings("unchecked")
+   public void commitUpdate(InvocationContext ctx, DataContainer container)
    {
+      // only do stuff if there are changes.
       if (isFlagSet(CHANGED))
       {
          Fqn fqn = getFqn();
@@ -110,10 +113,11 @@
                InternalNode parent = lookupParent(fqn, ctx, container);
                parent.removeChild(fqn.getLastElement());
                setValid(false, false);
-               updateNode(ctx, container, nodeFactory);
+               updateNode(ctx, container);
             }
             else
             {
+               // should never get here.  Other layers should prevent a delete on root.
                log.warn("Attempting to remove the root node.  Not doing anything!");
             }
          }
@@ -121,14 +125,15 @@
          {
             // add newly created nodes to parents.
             InternalNode parent = lookupParent(fqn, ctx, container);
-//            parent.addChildDirect(nodeFactory.createNodeInvocationDelegate(node, false));
             parent.addChild(node);
          }
          else
          {
-            updateNode(ctx, container, nodeFactory);
+            // Only content has been updated, just update refs.
+            updateNode(ctx, container);
          }
 
+         // reset internal flags and refs to backups, etc.
          reset();
       }
    }
@@ -154,12 +159,14 @@
       InternalNode retval;
       Fqn parentFqn = fqn.getParent();
       NodeSPI parent = ctx.lookUpNode(parentFqn);
+      // first check if the parent is cached in the context.
       if (parent != null)
       {
          retval = parent.getDelegationTarget();
       }
       else
       {
+         // if not, get it from the data container.  No need to wrap here, we're just going to update the parent's child map.
          retval = container.peekInternalNode(parentFqn, false);
       }
       if (retval == null)
@@ -172,9 +179,9 @@
     *
     * @param ctx           invocation context
     * @param dataContainer data container
-    * @param nf            node factory
     */
-   protected void updateNode(InvocationContext ctx, DataContainer dataContainer, NodeFactory nf)
+   @SuppressWarnings("unchecked")
+   protected void updateNode(InvocationContext ctx, DataContainer dataContainer)
    {
       // swap refs
       if (!isFlagSet(CREATED)) ((NodeReference) backup).setDelegate(node);
@@ -209,7 +216,8 @@
          unsetFlag(CREATED);
    }
 
-   // do not propagate deletion flags to the underlying node.
+   // do not delegate deletion flags to the InternalNode since this will cause problems with concurrent readers.  Maintain
+   // deletion information here and update on commit.
 
    @Override
    public boolean isDeleted()

Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -5,7 +5,6 @@
 import org.jboss.cache.DataContainer;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InternalNode;
-import org.jboss.cache.NodeFactory;
 import org.jboss.cache.invocation.InvocationContext;
 import static org.jboss.cache.mvcc.ReadCommittedNode.Flags.CHANGED;
 import static org.jboss.cache.mvcc.ReadCommittedNode.Flags.DELETED;
@@ -27,7 +26,7 @@
    }
 
    @Override
-   public void markForUpdate(InvocationContext ctx, DataContainer container, NodeFactory nodeFactory, boolean writeSkewCheck)
+   public void markForUpdate(DataContainer container, boolean writeSkewCheck)
    {
       if (isFlagSet(CHANGED)) return; // already copied
 
@@ -55,15 +54,17 @@
    }
 
    @Override
-   protected void updateNode(InvocationContext ctx, DataContainer dataContainer, NodeFactory nf)
+   @SuppressWarnings("unchecked")
+   protected void updateNode(InvocationContext ctx, DataContainer dataContainer)
    {
-      if (getFqn().isRoot())
+      Fqn fqn = getFqn();
+      if (fqn.isRoot())
       {
          dataContainer.setRoot(node);
       }
       else if (!isFlagSet(DELETED))
       {
-         InternalNode parent = lookupParent(getFqn(), ctx, dataContainer);
+         InternalNode parent = lookupParent(fqn, ctx, dataContainer);
          parent.addChild(node);
       }
    }

Modified: core/trunk/src/main/java/org/jboss/cache/optimistic/OptimisticNodeFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/optimistic/OptimisticNodeFactory.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/optimistic/OptimisticNodeFactory.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -15,7 +15,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @since 3.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class OptimisticNodeFactory<K, V> extends AbstractNodeFactory<K, V>
 {
    private LockStrategyFactory lockStrategyFactory;

Modified: core/trunk/src/main/java/org/jboss/cache/optimistic/TransactionWorkspace.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/optimistic/TransactionWorkspace.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/optimistic/TransactionWorkspace.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -21,8 +21,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @author Steve Woodcock (<a href="mailto:stevew at jofti.com">stevew at jofti.com</a>)
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
-
+ at Deprecated
 public interface TransactionWorkspace<K, V>
 {
    /**

Modified: core/trunk/src/main/java/org/jboss/cache/optimistic/TransactionWorkspaceImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/optimistic/TransactionWorkspaceImpl.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/optimistic/TransactionWorkspaceImpl.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -19,7 +19,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @author Steve Woodcock (<a href="mailto:stevew at jofti.com">stevew at jofti.com</a>)
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class TransactionWorkspaceImpl<K, V> implements TransactionWorkspace<K, V>
 {
 

Modified: core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNode.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNode.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -24,7 +24,9 @@
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @author Steve Woodcock (<a href="mailto:stevew at jofti.com">stevew at jofti.com</a>)
  * @since 1.3.0
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public interface WorkspaceNode<K, V>// extends Node<K, V>
 {
    Fqn getFqn();

Modified: core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -32,7 +32,9 @@
  *
  * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
  * @author Steve Woodcock (<a href="mailto:stevew at jofti.com">stevew at jofti.com</a>)
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class WorkspaceNodeImpl<K, V> extends AbstractNode<K, V> implements WorkspaceNode<K, V>
 {
 
@@ -215,7 +217,7 @@
    private void initialiseChildMap()
    {
       Map<Object, Node<K, V>> childrenMap = node.getChildrenMapDirect();
-      this.optimisticChildNodeMap = childrenMap == null ? new HashMap() : new HashMap(childrenMap);
+      this.optimisticChildNodeMap = new HashMap(childrenMap);
    }
 
    private void realPut(Map<K, V> data, boolean eraseData)

Modified: core/trunk/src/main/java/org/jboss/cache/transaction/OptimisticTransactionContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/OptimisticTransactionContext.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/OptimisticTransactionContext.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -19,8 +19,9 @@
  *
  * @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>
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
-
+ at Deprecated
 public class OptimisticTransactionContext extends PessimisticTransactionContext
 {
    private TransactionWorkspace transactionWorkSpace = new TransactionWorkspaceImpl();

Modified: core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -38,7 +38,9 @@
  * @author <a href="mailto:bela at jboss.org">Bela Ban</a>
  * @author Manik Surtani
  * @version $Revision$
+ * @deprecated will be removed along with optimistic and pessimistic locking.
  */
+ at Deprecated
 public class PessimisticTransactionContext implements TransactionContext
 {
 

Modified: core/trunk/src/main/java/org/jboss/cache/util/concurrent/SelfInitializingConcurrentHashMap.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/concurrent/SelfInitializingConcurrentHashMap.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/main/java/org/jboss/cache/util/concurrent/SelfInitializingConcurrentHashMap.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -1,7 +1,5 @@
 package org.jboss.cache.util.concurrent;
 
-import org.jboss.cache.UnversionedNode;
-
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
@@ -18,44 +16,8 @@
  */
 public class SelfInitializingConcurrentHashMap<K, V> implements ConcurrentMap<K, V>
 {
-   static boolean DEBUG = false; // TODO remove this
-
    private volatile ConcurrentMap<K, V> delegate;
-//   private int initialCapacity = -1, concurrencyLevel = -1;
-//   private float loadFactor = -1;
 
-   /**
-    * Creates a new delegate map and will use a default constructor to initialize the {@link java.util.concurrent.ConcurrentMap}
-    * it will eventually delegate to.
-    */
-   public SelfInitializingConcurrentHashMap()
-   {
-
-   }
-
-   /**
-    * Creates a new delegate map and will use the params passed in to initialize the {@link java.util.concurrent.ConcurrentMap}
-    * it will eventually delegate to.
-    *
-    * @param initialCapacity  the initial capacity. The implementation
-    *                         performs internal sizing to accommodate this many elements.
-    * @param loadFactor       the load factor threshold, used to control resizing.
-    *                         Resizing may be performed when the average number of elements per
-    *                         bin exceeds this threshold.
-    * @param concurrencyLevel the estimated number of concurrently
-    *                         updating threads. The implementation performs internal sizing
-    *                         to try to accommodate this many threads.
-    * @throws IllegalArgumentException if the initial capacity is
-    *                                  negative or the load factor or concurrencyLevel are
-    *                                  nonpositive.
-    */
-//   public SelfInitializingConcurrentHashMap(int initialCapacity, float loadFactor, int concurrencyLevel)
-//   {
-//      this.initialCapacity = initialCapacity;
-//      this.loadFactor = loadFactor;
-//      this.concurrencyLevel = concurrencyLevel;
-//   }
-
    // -------------- initialization methods and helpers ----------------------
    private ConcurrentMap<K, V> getDelegate()
    {
@@ -66,27 +28,13 @@
    private synchronized void init()
    {
       // Reminiscent of DCL but the delegate here is volatile so construction reordering should not affect.
-      if (delegate == null)
-      {
-         delegate = new ConcurrentHashMap<K, V>(4, 0.75f, 4);
-         // hard-coded for node child maps for now
-
-//         if (initialCapacity == -1 || concurrencyLevel == -1 || loadFactor == -1)
-//         {
-//            delegate = new ConcurrentHashMap<K, V>();
-//         }
-//         else
-//         {
-//            delegate = new ConcurrentHashMap<K, V>(initialCapacity, loadFactor, concurrencyLevel);
-//         }
-      }
+      if (delegate == null) delegate = new ConcurrentHashMap<K, V>(4, 0.75f, 4);
    }
 
    // -------------- Public API methods that will trigger initialization ----------------------
 
    public final V put(K key, V value)
    {
-      if (DEBUG) if (value instanceof UnversionedNode) throw new RuntimeException();
       return getDelegate().put(key, value);
    }
 
@@ -102,19 +50,16 @@
 
    public final V putIfAbsent(K key, V value)
    {
-      if (DEBUG) if (value instanceof UnversionedNode) throw new RuntimeException();
       return getDelegate().putIfAbsent(key, value);
    }
 
    public final boolean replace(K key, V oldValue, V newValue)
    {
-      if (DEBUG) if (oldValue instanceof UnversionedNode) throw new RuntimeException();
       return getDelegate().replace(key, oldValue, newValue);
    }
 
    public final V replace(K key, V value)
    {
-      if (DEBUG) if (value instanceof UnversionedNode) throw new RuntimeException();
       return getDelegate().replace(key, value);
    }
 
@@ -157,19 +102,19 @@
 
    public final Set<K> keySet()
    {
-      if (delegate == null) return Collections.emptySet();
+      if (delegate == null || delegate.isEmpty()) return Collections.emptySet();
       return delegate.keySet();
    }
 
    public final Collection<V> values()
    {
-      if (delegate == null) return Collections.emptySet();
+      if (delegate == null || delegate.isEmpty()) return Collections.emptySet();
       return delegate.values();
    }
 
    public final Set<Entry<K, V>> entrySet()
    {
-      if (delegate == null) return Collections.emptySet();
+      if (delegate == null || delegate.isEmpty()) return Collections.emptySet();
       return delegate.entrySet();
    }
 

Modified: core/trunk/src/test/java/org/jboss/cache/mock/NodeSpiMock.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/mock/NodeSpiMock.java	2008-07-31 09:23:24 UTC (rev 6459)
+++ core/trunk/src/test/java/org/jboss/cache/mock/NodeSpiMock.java	2008-07-31 11:07:45 UTC (rev 6460)
@@ -5,7 +5,6 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.InternalNode;
 import org.jboss.cache.Node;
-import org.jboss.cache.NodeFactory;
 import org.jboss.cache.NodeSPI;
 import org.jboss.cache.invocation.InvocationContext;
 import org.jboss.cache.lock.NodeLock;
@@ -301,12 +300,12 @@
       throw new UnsupportedOperationException();
    }
 
-   public void markForUpdate(InvocationContext ctx, DataContainer container, NodeFactory nodeFactory, boolean writeSkewCheck)
+   public void markForUpdate(DataContainer container, boolean writeSkewCheck)
    {
       throw new UnsupportedOperationException();
    }
 
-   public void commitUpdate(InvocationContext ctx, DataContainer container, NodeFactory nodeFactory)
+   public void commitUpdate(InvocationContext ctx, DataContainer container)
    {
       throw new UnsupportedOperationException();
    }




More information about the jbosscache-commits mailing list