Author: manik.surtani(a)jboss.com
Date: 2008-07-31 11:01:05 -0400 (Thu, 31 Jul 2008)
New Revision: 6465
Modified:
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
Log:
Using a peek to keep legacy code happy
Modified:
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-07-31
14:54:13 UTC (rev 6464)
+++
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-07-31
15:01:05 UTC (rev 6465)
@@ -35,6 +35,7 @@
import org.jboss.cache.config.Option;
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.interceptors.base.CommandInterceptor;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.marshall.Marshaller;
@@ -78,6 +79,7 @@
private DataContainer dataContainer;
private CommandsFactory commandsFactory;
private MVCCNodeHelper mvccHelper;
+ private boolean usingMvcc;
@Inject
public void initialize(StateTransferManager stateTransferManager, CacheLoaderManager
cacheLoaderManager, Notifier notifier,
@@ -99,8 +101,15 @@
this.mvccHelper = mvccHelper;
}
+ @Start
+ private void setNodeLockingScheme()
+ {
+ usingMvcc = configuration.getNodeLockingScheme() == NodeLockingScheme.MVCC;
+ }
+
private void reset()
{
+ this.usingMvcc = false;
this.stateTransferManager = null;
this.cacheLoaderManager = null;
this.transactionManager = null;
@@ -230,10 +239,17 @@
public boolean exists(Fqn fqn)
{
- InvocationContext ctx = invocationContextContainer.get();
- cacheStatusCheck(ctx);
- ExistsCommand command = commandsFactory.buildExistsNodeCommand(fqn);
- return (Boolean) invoker.invoke(ctx, command);
+ if (usingMvcc)
+ {
+ InvocationContext ctx = invocationContextContainer.get();
+ cacheStatusCheck(ctx);
+ ExistsCommand command = commandsFactory.buildExistsNodeCommand(fqn);
+ return (Boolean) invoker.invoke(ctx, command);
+ }
+ else
+ {
+ return peek(fqn, false) != null;
+ }
}
public Notifier getNotifier()
@@ -257,7 +273,7 @@
public NodeSPI<K, V> peek(Fqn fqn, boolean includeDeletedNodes, boolean
includeInvalidNodes)
{
// TODO: clean this up somehow! Anyway, this method should NOT be used outside of
testing frameworks.
- return (configuration.getNodeLockingScheme() == NodeLockingScheme.MVCC)
+ return (usingMvcc)
? mvccPeek(fqn)
: (NodeSPI<K, V>) dataContainer.peek(fqn, includeDeletedNodes,
includeInvalidNodes);
}
@@ -266,7 +282,7 @@
public NodeSPI<K, V> peek(Fqn fqn, boolean includeDeletedNodes)
{
// TODO: clean this up somehow! Anyway, this method should NOT be used outside of
testing frameworks.
- return (configuration.getNodeLockingScheme() == NodeLockingScheme.MVCC)
+ return (usingMvcc)
? mvccPeek(fqn)
: (NodeSPI<K, V>) dataContainer.peek(fqn, includeDeletedNodes);
}
Show replies by date