JBoss Cache SVN: r8462 - core/trunk/src/main/java/org/jboss/cache/interceptors.
by jbosscache-commits@lists.jboss.org
Author: dereed
Date: 2011-08-14 19:11:17 -0400 (Sun, 14 Aug 2011)
New Revision: 8462
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
Log:
[JBCACHE-1601] Fix data deletion issue with cache.getNode and passivation (for all but OPTIMISTIC, due to JBCACHE-1602)
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2011-08-09 22:47:23 UTC (rev 8461)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2011-08-14 23:11:17 UTC (rev 8462)
@@ -24,6 +24,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.commands.write.EvictCommand;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.base.JmxStatsCommandInterceptor;
@@ -114,14 +115,15 @@
}
NodeSPI n = ctx.lookUpNode(fqn);
- if (n != null)
- {
- return n.getDataDirect();
- }
- else
- {
+ if (n == null)
throw new NodeNotLoadedException();
- }
+
+ // Fix JBCACHE-1601. But NOT for OPTIMISTIC because of JBCACHE-1602
+ if (configuration.getNodeLockingScheme() != NodeLockingScheme.OPTIMISTIC
+&& !n.isDataLoaded())
+ throw new NodeNotLoadedException();
+
+ return n.getDataDirect();
}
private static class NodeNotLoadedException extends Exception