Author: mircea.markus
Date: 2007-10-09 11:28:53 -0400 (Tue, 09 Oct 2007)
New Revision: 4582
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
Log:
solved following issue on optimistic locking:
cache.move(sameNode, sameNode) removes sameNode
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2007-10-09
14:45:45 UTC (rev 4581)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2007-10-09
15:28:53 UTC (rev 4582)
@@ -228,13 +228,19 @@
log.warn("Attempting to move the root node. Not taking any action,
treating this as a no-op.");
return;
}
+
+ WorkspaceNode oldParent = fetchWorkspaceNode(nodeFqn.getParent(), ws, false);
+ if (oldParent == null) throw new NodeNotExistsException("Node " +
nodeFqn.getParent() + " does not exist!");
+
+ if (parentFqn.equals(oldParent.getFqn()))
+ {
+ log.warn("Attempting to move a node in same place. Not taking any action,
treating this as a no-op.");
+ return;
+ }
// retrieve parent
WorkspaceNode parent = fetchWorkspaceNode(parentFqn, ws, false);
if (parent == null) throw new NodeNotExistsException("Node " + parentFqn
+ " does not exist!");
- WorkspaceNode oldParent = fetchWorkspaceNode(nodeFqn.getParent(), ws, false);
- if (oldParent == null) throw new NodeNotExistsException("Node " +
nodeFqn.getParent() + " does not exist!");
-
Object nodeName = nodeFqn.getLastElement();
// now that we have the parent and target nodes:
Show replies by date