[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...
Manik Surtani
msurtani at jboss.com
Wed Sep 13 06:34:53 EDT 2006
User: msurtani
Date: 06/09/13 06:34:53
Modified: src/org/jboss/cache/interceptors
OptimisticNodeInterceptor.java
Log:
JBCACHE-767
Revision Changes Path
1.27 +292 -282 JBossCache/src/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OptimisticNodeInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- OptimisticNodeInterceptor.java 25 Aug 2006 14:10:07 -0000 1.26
+++ OptimisticNodeInterceptor.java 13 Sep 2006 10:34:53 -0000 1.27
@@ -15,11 +15,11 @@
import org.jboss.cache.TreeNode;
import org.jboss.cache.config.Option;
import org.jboss.cache.factories.NodeFactory;
+import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.optimistic.TransactionWorkspace;
import org.jboss.cache.optimistic.WorkspaceNode;
-import org.jboss.cache.marshall.MethodCall;
import javax.transaction.Transaction;
import java.util.Iterator;
@@ -60,9 +60,18 @@
// use explicit versioning
if (ctx.getOptionOverrides() != null && ctx.getOptionOverrides().getDataVersion() != null)
{
- workspace.setVersioningImplicit( false );
+ workspace.setVersioningImplicit(false);
DataVersion version = ctx.getOptionOverrides().getDataVersion();
- workspaceNode.setVersion( version );
+ // "fail-more-silently" patch thanks to Owen Taylor - JBCACHE-767
+ if (workspaceNode != null)
+ {
+ workspaceNode.setVersion(version);
+ }
+ else
+ {
+ if (ctx.getOptionOverrides() == null || !ctx.getOptionOverrides().isFailSilently())
+ throw new CacheException("Unable to set node version for " + getFqn(args) + ", node is null.");
+ }
}
switch (m.getMethodId())
@@ -103,7 +112,7 @@
}
else
{
- switch(m.getMethodId())
+ switch (m.getMethodId())
{
case MethodDeclarations.getKeyValueMethodLocal_id:
result = getValueForKey(args, workspace);
@@ -118,7 +127,8 @@
result = getNode(args, workspace);
break;
default:
- if (log.isInfoEnabled()) log.info("read Method " + m + " called - don't know how to handle, passing on!");
+ if (log.isInfoEnabled())
+ log.info("read Method " + m + " called - don't know how to handle, passing on!");
result = super.invoke(m);
break;
}
@@ -135,7 +145,7 @@
TransactionWorkspace workspace, WorkspaceNode workspaceNode)
{
- Map data = (Map)args[2];
+ Map data = (Map) args[2];
if (workspaceNode == null)
return;
workspaceNode.put(data, eraseExisitng);
@@ -310,7 +320,7 @@
DataNode node = ((TreeCacheProxyImpl) cache).peek(fqn);
if (node == null)
return null; // seems to happen quite a bit
- workspaceNode = NodeFactory.getInstance().createWorkspaceNode( node, workspace );
+ workspaceNode = NodeFactory.getInstance().createWorkspaceNode(node, workspace);
}
// the node has been deleted dude!
if (workspaceNode.isDeleted())
More information about the jboss-cvs-commits
mailing list