Author: manik.surtani(a)jboss.com
Date: 2008-04-28 08:10:28 -0400 (Mon, 28 Apr 2008)
New Revision: 5716
Added:
core/trunk/src/main/java/org/jboss/cache/commands/read/RemoteExistsCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/AbstractReplicableCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
Modified:
core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java
core/trunk/src/main/java/org/jboss/cache/commands/AbstractVisitor.java
core/trunk/src/main/java/org/jboss/cache/commands/Visitor.java
core/trunk/src/main/java/org/jboss/cache/commands/read/AbstractDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/tx/AbstractTransactionCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java
core/trunk/src/main/java/org/jboss/cache/factories/CommandsFactory.java
core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/base/PostProcessingChainedInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/loader/NonManagedConnectionFactory.java
core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java
Log:
worked on todos
Modified:
core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -11,13 +11,13 @@
import org.jboss.cache.commands.read.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
-import org.jboss.cache.commands.read.RemoteExistsNodeCommand;
+import org.jboss.cache.commands.read.RemoteExistsCommand;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.CreateNodeCommand;
-import org.jboss.cache.commands.write.EvictNodeCommand;
+import org.jboss.cache.commands.write.EvictCommand;
import org.jboss.cache.commands.write.InvalidateCommand;
import org.jboss.cache.commands.write.MoveCommand;
import org.jboss.cache.commands.write.PutDataMapCommand;
@@ -100,7 +100,7 @@
}
@Override
- public Object handleEvictFqnCommand(InvocationContext ctx, EvictNodeCommand command)
throws Throwable
+ public Object handleEvictFqnCommand(InvocationContext ctx, EvictCommand command)
throws Throwable
{
Fqn fqn = getBackupFqn(command.getFqn());
return factory.buildEvictFqnCommand(fqn);
@@ -128,7 +128,7 @@
}
@Override
- public Object handleExistsNodeCommand(InvocationContext ctx, RemoteExistsNodeCommand
command) throws Throwable
+ public Object handleExistsNodeCommand(InvocationContext ctx, RemoteExistsCommand
command) throws Throwable
{
Fqn transformed = getBackupFqn(command.getFqn());
return factory.buildEvictFqnCommand(transformed);
Modified: core/trunk/src/main/java/org/jboss/cache/commands/AbstractVisitor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/AbstractVisitor.java 2008-04-28
11:19:32 UTC (rev 5715)
+++ core/trunk/src/main/java/org/jboss/cache/commands/AbstractVisitor.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -7,13 +7,13 @@
import org.jboss.cache.commands.read.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
-import org.jboss.cache.commands.read.RemoteExistsNodeCommand;
+import org.jboss.cache.commands.read.RemoteExistsCommand;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.CreateNodeCommand;
-import org.jboss.cache.commands.write.EvictNodeCommand;
+import org.jboss.cache.commands.write.EvictCommand;
import org.jboss.cache.commands.write.InvalidateCommand;
import org.jboss.cache.commands.write.MoveCommand;
import org.jboss.cache.commands.write.PutDataMapCommand;
@@ -50,7 +50,7 @@
return handleDefault(ctx, command);
}
- public Object handleEvictFqnCommand(InvocationContext ctx, EvictNodeCommand command)
throws Throwable
+ public Object handleEvictFqnCommand(InvocationContext ctx, EvictCommand command)
throws Throwable
{
return handleDefault(ctx, command);
}
@@ -70,7 +70,7 @@
return handleDefault(ctx, command);
}
- public Object handleExistsNodeCommand(InvocationContext ctx, RemoteExistsNodeCommand
command) throws Throwable
+ public Object handleExistsNodeCommand(InvocationContext ctx, RemoteExistsCommand
command) throws Throwable
{
return handleDefault(ctx, command);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/Visitor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/Visitor.java 2008-04-28 11:19:32 UTC
(rev 5715)
+++ core/trunk/src/main/java/org/jboss/cache/commands/Visitor.java 2008-04-28 12:10:28 UTC
(rev 5716)
@@ -7,13 +7,13 @@
import org.jboss.cache.commands.read.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
-import org.jboss.cache.commands.read.RemoteExistsNodeCommand;
+import org.jboss.cache.commands.read.RemoteExistsCommand;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.CreateNodeCommand;
-import org.jboss.cache.commands.write.EvictNodeCommand;
+import org.jboss.cache.commands.write.EvictCommand;
import org.jboss.cache.commands.write.InvalidateCommand;
import org.jboss.cache.commands.write.MoveCommand;
import org.jboss.cache.commands.write.PutDataMapCommand;
@@ -67,7 +67,7 @@
1 - evictNodeMethodLocal_id
2 - evictVersionedNodeMethodLocal_id
*/
- Object handleEvictFqnCommand(InvocationContext ctx, EvictNodeCommand evictFqnCommand)
throws Throwable;
+ Object handleEvictFqnCommand(InvocationContext ctx, EvictCommand evictFqnCommand)
throws Throwable;
/*
equiv of old:
@@ -92,7 +92,7 @@
equiv of old:
1 - existsMethod_id
*/
- Object handleExistsNodeCommand(InvocationContext ctx, RemoteExistsNodeCommand
existsNodeCommand) throws Throwable;
+ Object handleExistsNodeCommand(InvocationContext ctx, RemoteExistsCommand
existsNodeCommand) throws Throwable;
/*
equiv of old:
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/AbstractDataCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/read/AbstractDataCommand.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/commands/read/AbstractDataCommand.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -3,14 +3,14 @@
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.commands.DataCommand;
+import org.jboss.cache.factories.annotations.CacheInjectionMethods;
import org.jboss.cache.factories.annotations.Inject;
/**
- * // TODO: MANIK: Document this
- *
* @author Manik Surtani (<a
href="mailto:manik@jboss.org">manik@jboss.org</a>)
* @since 2.2.0
*/
+@CacheInjectionMethods
public abstract class AbstractDataCommand implements DataCommand
{
protected Fqn fqn;
Copied: core/trunk/src/main/java/org/jboss/cache/commands/read/RemoteExistsCommand.java
(from rev 5714,
core/trunk/src/main/java/org/jboss/cache/commands/read/RemoteExistsNodeCommand.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/RemoteExistsCommand.java
(rev 0)
+++
core/trunk/src/main/java/org/jboss/cache/commands/read/RemoteExistsCommand.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -0,0 +1,53 @@
+package org.jboss.cache.commands.read;
+
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.Node;
+import org.jboss.cache.commands.Visitor;
+
+/**
+ * Checks whether a given node exists in current in-memory state of the cache.
+ * Does not acquire any locks in doing so (result may be dirty read). Does
+ * not attempt to load nodes from a cache loader (may return false if a
+ * node has been evicted).
+ *
+ * @author Mircea.Markus(a)jboss.com
+ * @since 2.2
+ * todo - this is only used when remote cache calls exists, nut sure it is
necessary to have it as a command
+ * todo- see if this is used at all!!
+ */
+public class RemoteExistsCommand extends AbstractDataCommand
+{
+ public static final int METHOD_ID = 16;
+
+ public RemoteExistsCommand()
+ {
+ }
+
+ public RemoteExistsCommand(Fqn fqn)
+ {
+ this.fqn = fqn;
+ }
+
+ public Object perform(InvocationContext ctx)
+ {
+ Node n = cacheData.peek(fqn, false);
+ return n != null;
+ }
+
+ public Object acceptVisitor(InvocationContext ctx, Visitor visitor) throws Throwable
+ {
+ return visitor.handleExistsNodeCommand(ctx, this);
+ }
+
+ public int getCommandId()
+ {
+ return METHOD_ID;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "RemoteExistsNodeCommand{}";
+ }
+}
Added:
core/trunk/src/main/java/org/jboss/cache/commands/remote/AbstractReplicableCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/AbstractReplicableCommand.java
(rev 0)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/AbstractReplicableCommand.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -0,0 +1,16 @@
+package org.jboss.cache.commands.remote;
+
+import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.factories.annotations.CacheInjectionMethods;
+
+/**
+ * An empty abstract class to provide the {@link
org.jboss.cache.factories.annotations.CacheInjectionMethods} annotation
+ * for all subclasses.
+ *
+ * @author Manik Surtani (<a
href="mailto:manik@jboss.org">manik@jboss.org</a>)
+ * @since 2.2.0
+ */
+@CacheInjectionMethods
+public abstract class AbstractReplicableCommand implements ReplicableCommand
+{
+}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -4,7 +4,6 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.buddyreplication.BuddyGroup;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.factories.annotations.Inject;
import java.util.Arrays;
@@ -14,7 +13,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class AssignToBuddyGroupCommand implements ReplicableCommand
+public class AssignToBuddyGroupCommand extends AbstractReplicableCommand
{
public static final int METHOD_ID = 29;
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -5,10 +5,9 @@
import org.jboss.cache.DataContainer;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.DataCommand;
-import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.read.GetChildrenNamesCommand;
import org.jboss.cache.commands.read.GetDataMapCommand;
-import org.jboss.cache.commands.read.RemoteExistsNodeCommand;
+import org.jboss.cache.commands.read.RemoteExistsCommand;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.InterceptorChain;
@@ -20,7 +19,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class ClusteredGetCommand implements ReplicableCommand
+public class ClusteredGetCommand extends AbstractReplicableCommand
{
public static final int METHOD_ID = 22;
@@ -107,7 +106,7 @@
{
return callResults != null &&
cacheData.exists(cacheDataComand.getFqn());
}
- return cacheDataComand instanceof RemoteExistsNodeCommand && (Boolean)
callResults;
+ return cacheDataComand instanceof RemoteExistsCommand && (Boolean)
callResults;
}
/**
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -8,8 +8,7 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.commands.ReplicableCommand;
-import org.jboss.cache.commands.write.EvictNodeCommand;
+import org.jboss.cache.commands.write.EvictCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
import org.jboss.cache.factories.CommandsFactory;
import org.jboss.cache.factories.annotations.Inject;
@@ -25,7 +24,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class DataGravitationCleanupCommand implements ReplicableCommand
+public class DataGravitationCleanupCommand extends AbstractReplicableCommand
{
public static final int METHOD_ID = 34;
@@ -143,7 +142,7 @@
List<Fqn> toEvict = cacheData.getNodesForEviction(fqn, true);
for (Fqn aFqn : toEvict)
{
- EvictNodeCommand evictFqnCommand =
commandsFactory.buildEvictFqnCommand(aFqn);
+ EvictCommand evictFqnCommand = commandsFactory.buildEvictFqnCommand(aFqn);
invoker.invoke(evictFqnCommand);
}
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -2,14 +2,13 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.factories.annotations.Inject;
/**
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class RemoveFromBuddyGroupCommand implements ReplicableCommand
+public class RemoveFromBuddyGroupCommand extends AbstractReplicableCommand
{
public static final int METHOD_ID = 30;
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -18,7 +18,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class ReplicateCommand implements ReplicableCommand
+public class ReplicateCommand extends AbstractReplicableCommand
{
public static final int SINGLE_METHOD_ID = 13;
public static final int MULTIPLE_METHOD_ID = 14;
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/tx/AbstractTransactionCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/tx/AbstractTransactionCommand.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/commands/tx/AbstractTransactionCommand.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -2,6 +2,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.VisitableCommand;
+import org.jboss.cache.factories.annotations.CacheInjectionMethods;
import org.jboss.cache.transaction.GlobalTransaction;
/**
@@ -10,6 +11,7 @@
* @author Manik Surtani (<a
href="mailto:manik@jboss.org">manik@jboss.org</a>)
* @since 2.2.0
*/
+@CacheInjectionMethods
public abstract class AbstractTransactionCommand implements VisitableCommand
{
protected GlobalTransaction globalTransaction;
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -3,6 +3,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.commands.VersionedDataCommand;
import org.jboss.cache.commands.read.AbstractDataCommand;
+import org.jboss.cache.factories.annotations.CacheInjectionMethods;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.optimistic.DataVersion;
@@ -14,6 +15,7 @@
* @author Manik Surtani (<a
href="mailto:manik@jboss.org">manik@jboss.org</a>)
* @since 2.2.0
*/
+@CacheInjectionMethods
public abstract class AbstractVersionedDataCommand extends AbstractDataCommand implements
VersionedDataCommand
{
protected DataVersion dataVersion;
Copied: core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java (from
rev 5714, core/trunk/src/main/java/org/jboss/cache/commands/write/EvictNodeCommand.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
(rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -0,0 +1,106 @@
+package org.jboss.cache.commands.write;
+
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.commands.Visitor;
+
+import java.util.List;
+
+/**
+ * Implements functionality defined by {@link
org.jboss.cache.CacheSPI#evict(org.jboss.cache.Fqn)}
+ *
+ * @author Mircea.Markus(a)jboss.com
+ * @since 2.2
+ */
+public class EvictCommand extends AbstractVersionedDataCommand
+{
+ public static final int METHOD_ID = 8;
+ public static final int VERSIONED_METHOD_ID = 9;
+
+ private boolean recursive = false;
+
+ public EvictCommand(Fqn fqn)
+ {
+ this.fqn = fqn;
+ }
+
+ public Object perform(InvocationContext ctx)
+ {
+ if (recursive)
+ {
+
+ List<Fqn> nodesToEvict = cacheData.getNodesForEviction(fqn, true);
+
+ for (Fqn aFqn : nodesToEvict)
+ {
+ evictNode(aFqn, ctx);
+ }
+ }
+ else
+ {
+ evictNode(fqn, ctx);
+ }
+ return null;
+ }
+
+ void evictNode(Fqn fqn, InvocationContext ctx)
+ {
+ notifier.notifyNodeEvicted(fqn, true, ctx);
+ cacheData.evict(fqn);
+ notifier.notifyNodeEvicted(fqn, false, ctx);
+ }
+
+ public Object acceptVisitor(InvocationContext ctx, Visitor visitor) throws Throwable
+ {
+ return visitor.handleEvictFqnCommand(ctx, this);
+ }
+
+ public int getCommandId()
+ {
+ return isVersioned() ? VERSIONED_METHOD_ID : METHOD_ID;
+ }
+
+ @Override
+ protected boolean isVersionedId(int id)
+ {
+ return VERSIONED_METHOD_ID == id;
+ }
+
+ public boolean isRecursive()
+ {
+ return recursive;
+ }
+
+ public void setRecursive(boolean recursive)
+ {
+ this.recursive = recursive;
+ }
+
+ @Override
+ public Object[] getParameters()
+ {
+ throw new UnsupportedOperationException(getClass().getSimpleName() + " is not
meant to be marshalled and replicated!");
+ }
+
+ @Override
+ public void setParameters(int commandId, Object[] args)
+ {
+ throw new UnsupportedOperationException(getClass().getSimpleName() + " is not
meant to be marshalled and replicated!");
+ }
+
+
+ @Override
+ public String toString()
+ {
+ return "EvictNodeCommand{" +
+ "fqn=" + fqn +
+ ", recursive=" + recursive +
+ ", dataVersion=" + dataVersion +
+ "}";
+ }
+
+ public void rollback()
+ {
+ // this is a no-op.
+ }
+}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -12,6 +12,7 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Option;
import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.optimistic.DataVersion;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
@@ -31,7 +32,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class InvalidateCommand extends EvictNodeCommand
+public class InvalidateCommand extends EvictCommand
{
public static final int METHOD_ID = 47;
private static final Log log = LogFactory.getLog(InvalidateCommand.class);
@@ -65,7 +66,7 @@
@Override
public Object perform(InvocationContext ctx)
{
- //todo - rather than using CacheSPI this can rely in cache loader directly to load
data
+ //todo - rather than using CacheSPI this should use peek(). The other interceptors
should obtain locks and load nodes if necessary for this InvalidateCommand.
Node node = spi.getNode(fqn); // force interceptor chain, load if necessary from
cache loader.
if (trace) log.trace("Invalidating fqn:" + fqn);
@@ -185,4 +186,18 @@
", dataVersion=" + dataVersion +
'}';
}
+
+ @Override
+ public Object[] getParameters()
+ {
+ return new Object[]{fqn, dataVersion};
+ }
+
+ @Override
+ public void setParameters(int commandId, Object[] args)
+ {
+ fqn = (Fqn) args[0];
+ dataVersion = (DataVersion) args[1];
+ }
+
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -6,8 +6,6 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
@@ -27,8 +25,6 @@
private static final Log log = LogFactory.getLog(RemoveNodeCommand.class);
private static boolean trace;
- private boolean isOptimistic;
-
/*parameters*/
private boolean createUndoOps;
private boolean skipSendingNodeEvents;
@@ -52,13 +48,6 @@
this.eviction = eviction;
}
- @Inject
- public void initialize(Configuration configuration)
- {
- this.isOptimistic = configuration.isNodeLockingOptimistic();
- }
-
- //todo - why is this method using optimisticLocking param, as it NEVER gets called in
an optimistic cache as it is intercepted
public Object perform(InvocationContext ctx)
{
NodeSPI parentNode;
@@ -79,7 +68,7 @@
boolean found;
// remove subtree from parent
- if (eviction || isOptimistic)
+ if (eviction)
{
// if there is no parent node and the fqn is root, found == true otherwise found
== false.
found = targetNode.isValid() && parentNode == null ? fqn.isRoot() :
parentNode.removeChildDirect(targetNode.getFqn().getLastElement());
Modified: core/trunk/src/main/java/org/jboss/cache/factories/CommandsFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/CommandsFactory.java 2008-04-28
11:19:32 UTC (rev 5715)
+++ core/trunk/src/main/java/org/jboss/cache/factories/CommandsFactory.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -13,7 +13,7 @@
import org.jboss.cache.commands.read.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
-import org.jboss.cache.commands.read.RemoteExistsNodeCommand;
+import org.jboss.cache.commands.read.RemoteExistsCommand;
import org.jboss.cache.commands.remote.AnnounceBuddyPoolNameCommand;
import org.jboss.cache.commands.remote.AssignToBuddyGroupCommand;
import org.jboss.cache.commands.remote.ClusteredGetCommand;
@@ -25,7 +25,7 @@
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.CreateNodeCommand;
-import org.jboss.cache.commands.write.EvictNodeCommand;
+import org.jboss.cache.commands.write.EvictCommand;
import org.jboss.cache.commands.write.InvalidateCommand;
import org.jboss.cache.commands.write.MoveCommand;
import org.jboss.cache.commands.write.PutDataMapCommand;
@@ -150,9 +150,9 @@
return command;
}
- public EvictNodeCommand buildEvictFqnCommand(Fqn fqn)
+ public EvictCommand buildEvictFqnCommand(Fqn fqn)
{
- EvictNodeCommand command = new EvictNodeCommand(fqn);
+ EvictCommand command = new EvictCommand(fqn);
registry.wireDependencies(command);
return command;
}
@@ -178,9 +178,9 @@
return command;
}
- public RemoteExistsNodeCommand buildExistsNodeCommand(Fqn fqn)
+ public RemoteExistsCommand buildExistsNodeCommand(Fqn fqn)
{
- RemoteExistsNodeCommand command = new RemoteExistsNodeCommand(fqn);
+ RemoteExistsCommand command = new RemoteExistsCommand(fqn);
registry.wireDependencies(command);
return command;
}
@@ -292,12 +292,11 @@
*/
public ReplicableCommand fromStream(int id, Object[] parameters)
{
- // todo: must be a better way to do this!!!
ReplicableCommand returnValue;
switch (id)
{
- case RemoteExistsNodeCommand.METHOD_ID:
- returnValue = new RemoteExistsNodeCommand();
+ case RemoteExistsCommand.METHOD_ID:
+ returnValue = new RemoteExistsCommand();
break;
case GetChildrenNamesCommand.METHOD_ID:
Modified: core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java 2008-04-28
11:19:32 UTC (rev 5715)
+++ core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -57,13 +57,13 @@
* </ul>
* <p/>
* Cache configuration can only be changed and will only be reinjected if the cache is
not in the {@link org.jboss.cache.CacheStatus#STARTED} state.
- * todo [mmarkus] remove dependecies on components from this class and move it elsewhere
(e.g. dependecy on CacgeSPI, Configuration etc)
*
* @author Manik Surtani (<a
href="mailto:manik@jboss.org">manik@jboss.org</a>)
* @since 2.1.0
*/
public class ComponentRegistry
{
+ // TODO: Needs refactoring
static final Object NULL_COMPONENT = new Object();
State overallState = CONSTRUCTED;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -24,7 +24,7 @@
import org.jboss.cache.DataContainer;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.read.GetKeyValueCommand;
-import org.jboss.cache.commands.write.EvictNodeCommand;
+import org.jboss.cache.commands.write.EvictCommand;
import org.jboss.cache.commands.write.PutDataMapCommand;
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.factories.annotations.Inject;
@@ -60,7 +60,7 @@
}
@Override
- public Object handleEvictFqnCommand(InvocationContext ctx, EvictNodeCommand command)
throws Throwable
+ public Object handleEvictFqnCommand(InvocationContext ctx, EvictCommand command)
throws Throwable
{
Object returnValue = invokeNextInterceptor(ctx, command);
m_evictions++;
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -22,7 +22,7 @@
import org.jboss.cache.commands.read.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
-import org.jboss.cache.commands.read.RemoteExistsNodeCommand;
+import org.jboss.cache.commands.read.RemoteExistsCommand;
import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
@@ -107,7 +107,7 @@
}
@Override
- public Object handleExistsNodeCommand(InvocationContext ctx, RemoteExistsNodeCommand
command) throws Throwable
+ public Object handleExistsNodeCommand(InvocationContext ctx, RemoteExistsCommand
command) throws Throwable
{
return handleGetMethod(ctx, command);
}
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -16,7 +16,7 @@
import org.jboss.cache.commands.read.GetDataMapCommand;
import org.jboss.cache.commands.read.GetKeyValueCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
-import org.jboss.cache.commands.write.EvictNodeCommand;
+import org.jboss.cache.commands.write.EvictCommand;
import org.jboss.cache.commands.write.PutDataMapCommand;
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.commands.write.RemoveDataCommand;
@@ -60,7 +60,7 @@
}
@Override
- public Object handleEvictFqnCommand(InvocationContext ctx, EvictNodeCommand command)
throws Throwable
+ public Object handleEvictFqnCommand(InvocationContext ctx, EvictCommand command)
throws Throwable
{
Fqn fqn = command.getFqn();
Object retVal = invokeNextInterceptor(ctx, command);
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -19,7 +19,7 @@
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.CreateNodeCommand;
-import org.jboss.cache.commands.write.EvictNodeCommand;
+import org.jboss.cache.commands.write.EvictCommand;
import org.jboss.cache.commands.write.MoveCommand;
import org.jboss.cache.commands.write.PutDataMapCommand;
import org.jboss.cache.commands.write.PutKeyValueCommand;
@@ -297,9 +297,9 @@
}
@Override
- public Object handleEvictFqnCommand(InvocationContext ctx, EvictNodeCommand
command) throws Throwable
+ public Object handleEvictFqnCommand(InvocationContext ctx, EvictCommand command)
throws Throwable
{
- EvictNodeCommand clone =
commandsFactory.buildEvictFqnCommand(command.getFqn());
+ EvictCommand clone = commandsFactory.buildEvictFqnCommand(command.getFqn());
return setDataVersion(clone, command.getFqn());
}
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -4,7 +4,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.write.EvictNodeCommand;
+import org.jboss.cache.commands.write.EvictCommand;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.base.VisitorInterceptor;
@@ -49,7 +49,7 @@
* store using the CacheLoader.
*/
@Override
- public Object handleEvictFqnCommand(InvocationContext ctx, EvictNodeCommand
evictFqnCommand) throws Throwable
+ public Object handleEvictFqnCommand(InvocationContext ctx, EvictCommand
evictFqnCommand) throws Throwable
{
Fqn fqn = evictFqnCommand.getFqn();
try
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -18,7 +18,7 @@
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.commands.write.EvictNodeCommand;
+import org.jboss.cache.commands.write.EvictCommand;
import org.jboss.cache.commands.write.MoveCommand;
import org.jboss.cache.commands.write.PutDataMapCommand;
import org.jboss.cache.commands.write.PutKeyValueCommand;
@@ -261,7 +261,7 @@
}
@Override
- public Object executeEvictFqnCommand(InvocationContext ctx, EvictNodeCommand command)
throws Throwable
+ public Object executeEvictFqnCommand(InvocationContext ctx, EvictCommand command)
throws Throwable
{
lockManager.acquireLocksWithTimeout(ctx, command.getFqn(), NodeLock.LockType.WRITE,
false, true, false, false, null, false);
return invokeNextInterceptor(ctx, command);
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/base/PostProcessingChainedInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/base/PostProcessingChainedInterceptor.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/base/PostProcessingChainedInterceptor.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -8,12 +8,12 @@
import org.jboss.cache.commands.read.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
-import org.jboss.cache.commands.read.RemoteExistsNodeCommand;
+import org.jboss.cache.commands.read.RemoteExistsCommand;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.commands.write.EvictNodeCommand;
+import org.jboss.cache.commands.write.EvictCommand;
import org.jboss.cache.commands.write.InvalidateCommand;
import org.jboss.cache.commands.write.MoveCommand;
import org.jboss.cache.commands.write.PutDataMapCommand;
@@ -104,7 +104,7 @@
}
@Override
- public final Object handleEvictFqnCommand(InvocationContext ctx, EvictNodeCommand
command) throws Throwable
+ public final Object handleEvictFqnCommand(InvocationContext ctx, EvictCommand command)
throws Throwable
{
try
{
@@ -116,7 +116,7 @@
}
}
- public Object executeEvictFqnCommand(InvocationContext ctx, EvictNodeCommand command)
throws Throwable
+ public Object executeEvictFqnCommand(InvocationContext ctx, EvictCommand command)
throws Throwable
{
return executeAll(ctx, command);
}
@@ -176,7 +176,7 @@
}
@Override
- public final Object handleExistsNodeCommand(InvocationContext ctx,
RemoteExistsNodeCommand command) throws Throwable
+ public final Object handleExistsNodeCommand(InvocationContext ctx, RemoteExistsCommand
command) throws Throwable
{
try
{
@@ -188,7 +188,7 @@
}
}
- public Object executeExistsNodeCommand(InvocationContext ctx, RemoteExistsNodeCommand
command) throws Throwable
+ public Object executeExistsNodeCommand(InvocationContext ctx, RemoteExistsCommand
command) throws Throwable
{
return executeAll(ctx, command);
}
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -8,12 +8,12 @@
import org.jboss.cache.commands.read.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
-import org.jboss.cache.commands.read.RemoteExistsNodeCommand;
+import org.jboss.cache.commands.read.RemoteExistsCommand;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.commands.write.EvictNodeCommand;
+import org.jboss.cache.commands.write.EvictCommand;
import org.jboss.cache.commands.write.InvalidateCommand;
import org.jboss.cache.commands.write.MoveCommand;
import org.jboss.cache.commands.write.PutDataMapCommand;
@@ -93,7 +93,7 @@
}
@Override
- public final Object handleEvictFqnCommand(InvocationContext ctx, EvictNodeCommand
command) throws Throwable
+ public final Object handleEvictFqnCommand(InvocationContext ctx, EvictCommand command)
throws Throwable
{
if (skipInterception(ctx))
{
@@ -102,7 +102,7 @@
return executeEvictFqnCommand(ctx, command);
}
- public Object executeEvictFqnCommand(InvocationContext ctx, EvictNodeCommand command)
throws Throwable
+ public Object executeEvictFqnCommand(InvocationContext ctx, EvictCommand command)
throws Throwable
{
return executeAll(ctx, command);
}
@@ -153,7 +153,7 @@
}
@Override
- public final Object handleExistsNodeCommand(InvocationContext ctx,
RemoteExistsNodeCommand command) throws Throwable
+ public final Object handleExistsNodeCommand(InvocationContext ctx, RemoteExistsCommand
command) throws Throwable
{
if (skipInterception(ctx))
{
@@ -162,7 +162,7 @@
return executeExistsNodeCommand(ctx, command);
}
- public Object executeExistsNodeCommand(InvocationContext ctx, RemoteExistsNodeCommand
command) throws Throwable
+ public Object executeExistsNodeCommand(InvocationContext ctx, RemoteExistsCommand
command) throws Throwable
{
return executeAll(ctx, command);
}
Modified:
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -9,6 +9,7 @@
import org.jboss.cache.commands.read.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
+import org.jboss.cache.commands.write.EvictCommand;
import org.jboss.cache.commands.write.MoveCommand;
import org.jboss.cache.commands.write.PutDataMapCommand;
import org.jboss.cache.commands.write.PutKeyValueCommand;
@@ -342,12 +343,9 @@
{
InvocationContext ctx = invocationContextContainer.get();
cacheStatusCheck(ctx);
- List<Fqn> nodesToEvict = cacheData.getNodesForEviction(fqn, recursive);
- //todo optimize this so that it performs only one call disregarding
- for (Fqn aFqn : nodesToEvict)
- {
- invoker.invoke(ctx, commandsFactory.buildEvictFqnCommand(aFqn));
- }
+ EvictCommand c = commandsFactory.buildEvictFqnCommand(fqn);
+ c.setRecursive(recursive);
+ invoker.invoke(ctx, c);
}
public void evict(Fqn<?> fqn)
Modified: core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java 2008-04-28
11:19:32 UTC (rev 5715)
+++ core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -18,7 +18,7 @@
import org.jboss.cache.commands.read.GetChildrenNamesCommand;
import org.jboss.cache.commands.read.GetDataMapCommand;
import org.jboss.cache.commands.read.GetKeyValueCommand;
-import org.jboss.cache.commands.read.RemoteExistsNodeCommand;
+import org.jboss.cache.commands.read.RemoteExistsCommand;
import org.jboss.cache.commands.remote.ClusteredGetCommand;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.factories.CommandsFactory;
@@ -190,7 +190,7 @@
lock.acquireLock(name, false);
try
{
- RemoteExistsNodeCommand command = commandsFactory.buildExistsNodeCommand(name);
+ RemoteExistsCommand command = commandsFactory.buildExistsNodeCommand(name);
Object resp = callRemote(command);
return resp != null && (Boolean) resp;
}
Modified:
core/trunk/src/main/java/org/jboss/cache/loader/NonManagedConnectionFactory.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/loader/NonManagedConnectionFactory.java 2008-04-28
11:19:32 UTC (rev 5715)
+++
core/trunk/src/main/java/org/jboss/cache/loader/NonManagedConnectionFactory.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -22,7 +22,7 @@
class NonManagedConnectionFactory implements ConnectionFactory
{
private static final Log log = LogFactory.getLog(NonManagedConnectionFactory.class);
-
+
static final ThreadLocal<Connection> connection = new
ThreadLocal<Connection>();
private String url;
@@ -65,14 +65,14 @@
if (log.isTraceEnabled())
{
log.trace("opened tx connection: tx=" + tx + ", con=" +
con);
- }
+ }
}
public Connection getConnection()
{
Connection con = connection.get();
-
+
if (con == null)
{
try
@@ -128,11 +128,6 @@
public void rollback(Object tx)
{
Connection con = connection.get();
- if (con == null)
- {
- // todo: prepare was not called. why is rollback called?
- throw new IllegalStateException("Failed to rollback: thread is not
associated with the connection!");
- }
try
{
@@ -159,7 +154,7 @@
try
{
con.close();
-
+
if (log.isTraceEnabled())
{
log.trace("closed non tx connection: " + con);
@@ -167,7 +162,7 @@
}
catch (SQLException e)
{
- log.warn("Failed to close connection " + con , e);
+ log.warn("Failed to close connection " + con, e);
}
}
}
@@ -194,20 +189,23 @@
public String getDriverClass()
{
return driverClass;
- }
+ }
protected void loadDriver(String drv)
{
try
{
- if (log.isTraceEnabled()) { log.trace("Attempting to load driver: " +
drv); }
+ if (log.isTraceEnabled())
+ {
+ log.trace("Attempting to load driver: " + drv);
+ }
Class.forName(drv).newInstance();
}
catch (Exception e)
{
reportAndRethrowError("Failed to load driver " + drv, e);
}
- }
+ }
private void closeTxConnection(Connection con)
{
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java 2008-04-28
11:19:32 UTC (rev 5715)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java 2008-04-28
12:10:28 UTC (rev 5716)
@@ -20,7 +20,7 @@
import org.jboss.cache.commands.read.GetKeyValueCommand;
import org.jboss.cache.commands.read.GetKeysCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
-import org.jboss.cache.commands.read.RemoteExistsNodeCommand;
+import org.jboss.cache.commands.read.RemoteExistsCommand;
import org.jboss.cache.commands.remote.AnnounceBuddyPoolNameCommand;
import org.jboss.cache.commands.remote.AssignToBuddyGroupCommand;
import org.jboss.cache.commands.remote.ClusteredGetCommand;
@@ -32,7 +32,7 @@
import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.commands.write.EvictNodeCommand;
+import org.jboss.cache.commands.write.EvictCommand;
import org.jboss.cache.commands.write.InvalidateCommand;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.annotations.ComponentName;
@@ -143,14 +143,14 @@
break;
case GravitateDataCommand.METHOD_ID:
- case EvictNodeCommand.METHOD_ID:
- case EvictNodeCommand.VERSIONED_METHOD_ID:
+ case EvictCommand.METHOD_ID:
+ case EvictCommand.VERSIONED_METHOD_ID:
case InvalidateCommand.METHOD_ID:
case GetChildrenNamesCommand.METHOD_ID:
case GetDataMapCommand.METHOD_ID:
case GetKeyValueCommand.METHOD_ID:
case GetKeysCommand.METHOD_ID:
- case RemoteExistsNodeCommand.METHOD_ID:
+ case RemoteExistsCommand.METHOD_ID:
fqn = ((DataCommand) cmd).getFqn();
break;