Author: manik.surtani(a)jboss.com
Date: 2008-04-29 10:28:51 -0400 (Tue, 29 Apr 2008)
New Revision: 5753
Added:
core/trunk/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java
Removed:
core/trunk/src/main/java/org/jboss/cache/commands/read/RemoteExistsCommand.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/ReplicableCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/Visitor.java
core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/read/GetNodeCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.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/CreateNodeCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.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/interceptors/DataGravitatorInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/base/PostProcessingCommandInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java
core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java
Log:
Javadocs and renaming
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-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -5,13 +5,13 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.AbstractVisitor;
import org.jboss.cache.commands.ReversibleCommand;
+import org.jboss.cache.commands.read.ExistsCommand;
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.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
-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;
@@ -128,7 +128,7 @@
}
@Override
- public Object visitExistsNodeCommand(InvocationContext ctx, RemoteExistsCommand
command) throws Throwable
+ public Object visitExistsNodeCommand(InvocationContext ctx, ExistsCommand 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-29
14:17:19 UTC (rev 5752)
+++ core/trunk/src/main/java/org/jboss/cache/commands/AbstractVisitor.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -1,13 +1,13 @@
package org.jboss.cache.commands;
import org.jboss.cache.InvocationContext;
+import org.jboss.cache.commands.read.ExistsCommand;
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.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
-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;
@@ -73,7 +73,7 @@
return handleDefault(ctx, command);
}
- public Object visitExistsNodeCommand(InvocationContext ctx, RemoteExistsCommand
command) throws Throwable
+ public Object visitExistsNodeCommand(InvocationContext ctx, ExistsCommand command)
throws Throwable
{
return handleDefault(ctx, command);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/ReplicableCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/ReplicableCommand.java 2008-04-29
14:17:19 UTC (rev 5752)
+++ core/trunk/src/main/java/org/jboss/cache/commands/ReplicableCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -13,7 +13,8 @@
public interface ReplicableCommand extends Cloneable
{
/**
- * Performs the primary function of the command.
+ * Performs the primary function of the command. Please see specific implementation
classes for details on what is
+ * performed as well as return types.
*
* @param ctx invocation context
* @return arbitrary return value generated by performing this 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-29 14:17:19 UTC
(rev 5752)
+++ core/trunk/src/main/java/org/jboss/cache/commands/Visitor.java 2008-04-29 14:28:51 UTC
(rev 5753)
@@ -1,13 +1,13 @@
package org.jboss.cache.commands;
import org.jboss.cache.InvocationContext;
+import org.jboss.cache.commands.read.ExistsCommand;
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.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
-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;
@@ -121,7 +121,7 @@
* @return response from the visit
* @throws Throwable in the event of problems.
*/
- Object visitExistsNodeCommand(InvocationContext ctx, RemoteExistsCommand command)
throws Throwable;
+ Object visitExistsNodeCommand(InvocationContext ctx, ExistsCommand command) throws
Throwable;
/**
* Visits a GetKeyValueCommand.
Copied: core/trunk/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java (from
rev 5738,
core/trunk/src/main/java/org/jboss/cache/commands/read/RemoteExistsCommand.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java
(rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/ExistsCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -0,0 +1,57 @@
+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).
+ * <p/>
+ * Specifically used by the {@link org.jboss.cache.loader.ClusteredCacheLoader} to
+ * implement {@link org.jboss.cache.loader.CacheLoader#exists(org.jboss.cache.Fqn)}
+ * <p/>
+ * This is the equivalent of the old MethodCallDefinitions.existsMethod method call from
2.1.x.
+ * <p/>
+ *
+ * @author Mircea.Markus(a)jboss.com
+ * @since 2.2.0
+ */
+public class ExistsCommand extends AbstractDataCommand
+{
+ public static final int METHOD_ID = 16;
+
+ public ExistsCommand()
+ {
+ }
+
+ public ExistsCommand(Fqn fqn)
+ {
+ this.fqn = fqn;
+ }
+
+ /**
+ * Checks whether a node represented by a given Fqn exists.
+ *
+ * @param ctx invocation context
+ * @return true if the node exists, false otherwise.
+ */
+ public Object perform(InvocationContext ctx)
+ {
+ Node n = dataContainer.peek(fqn, false);
+ return n != null;
+ }
+
+ public Object acceptVisitor(InvocationContext ctx, Visitor visitor) throws Throwable
+ {
+ return visitor.visitExistsNodeCommand(ctx, this);
+ }
+
+ public int getCommandId()
+ {
+ return METHOD_ID;
+ }
+}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java 2008-04-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -33,6 +33,12 @@
this.fqn = fqn;
}
+ /**
+ * Retrieves the names of children for a specific Fqn.
+ *
+ * @param ctx invocation context
+ * @return a Set<Object> of child names, for a given Fqn, or null if the Fqn
refers to a node that does not exist.
+ */
public Object perform(InvocationContext ctx)
{
NodeSPI n = dataContainer.findNode(fqn);
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java 2008-04-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -29,6 +29,12 @@
this.fqn = fqn;
}
+ /**
+ * Retrieves an unmodifiable map of data contained in a node referenced by the
specified Fqn.
+ *
+ * @param ctx invocation context
+ * @return an unmodifiable Map<K, V> of data contained in a node for a given
Fqn, or null if the Fqn refers to a node that does not exist.
+ */
public Object perform(InvocationContext ctx)
{
NodeSPI n = dataContainer.findNode(fqn);
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java 2008-04-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeyValueCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -47,6 +47,12 @@
this.notifier = notifier;
}
+ /**
+ * Retrieves the value stored under a specified key in a node referenced by the
specified Fqn.
+ *
+ * @param ctx invocation context
+ * @return an Object of type V, stored under a specific key in a node for a given Fqn,
or null if the Fqn refers to a node that does not exist.
+ */
public Object perform(InvocationContext ctx)
{
if (trace)
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java 2008-04-29
14:17:19 UTC (rev 5752)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GetKeysCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -30,13 +30,17 @@
this.fqn = fqn;
}
+ /**
+ * Retrieves Set of keys for all the data stored in a node referenced by the specified
Fqn.
+ *
+ * @param ctx invocation context
+ * @return a Set<K> of data keys contained in a node for a given Fqn, or null if
the Fqn refers to a node that does not exist.
+ */
+ @SuppressWarnings("unchecked")
public Object perform(InvocationContext ctx)
{
NodeSPI n = dataContainer.findNode(fqn);
- if (n == null)
- {
- return null;
- }
+ if (n == null) return null;
Set keys = n.getKeysDirect();
return new HashSet(keys);
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/GetNodeCommand.java 2008-04-29
14:17:19 UTC (rev 5752)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GetNodeCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -26,6 +26,12 @@
this.fqn = fqn;
}
+ /**
+ * Retrieves a {@link org.jboss.cache.Node} referenced by the specified Fqn.
+ *
+ * @param ctx invocation context
+ * @return a Node, or null if the Fqn refers to a node that does not exist.
+ */
public Object perform(InvocationContext ctx)
{
return dataContainer.findNode(fqn);
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java 2008-04-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -62,6 +62,13 @@
this.spi = spi;
}
+ /**
+ * Searches for data to gravitate given an Fqn and whether buddy backup subtrees are
to be searched as well. Note that
+ * data stored under the Fqn, along with all children, are retrieved.
+ *
+ * @param ctx invocation context
+ * @return a {@link org.jboss.cache.buddyreplication.GravitateResult} containing node
data, as well as information on whether this was found in a primary or backup tree.
+ */
public Object perform(InvocationContext ctx)
{
// for now, perform a very simple series of getData calls.
Deleted: core/trunk/src/main/java/org/jboss/cache/commands/read/RemoteExistsCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/read/RemoteExistsCommand.java 2008-04-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/read/RemoteExistsCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -1,51 +0,0 @@
-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).
- * <p/>
- * Specifically used by the {@link org.jboss.cache.loader.ClusteredCacheLoader} to
- * implement {@link org.jboss.cache.loader.CacheLoader#exists(org.jboss.cache.Fqn)}
- * <p/>
- * This is the equivalent of the old MethodCallDefinitions.existsMethod method call from
2.1.x.
- * <p/>
- *
- * @author Mircea.Markus(a)jboss.com
- * @since 2.2.0
- */
-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 = dataContainer.peek(fqn, false);
- return n != null;
- }
-
- public Object acceptVisitor(InvocationContext ctx, Visitor visitor) throws Throwable
- {
- return visitor.visitExistsNodeCommand(ctx, this);
- }
-
- public int getCommandId()
- {
- return METHOD_ID;
- }
-}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java 2008-04-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -43,6 +43,13 @@
this.buddyManager = buddyManager;
}
+ /**
+ * This method calls the relevant handler on the buddy manager to deal with this pool
broadcast.
+ *
+ * @param ctx invocation context, ignored.
+ * @return null
+ * @throws Throwable in the event of problems
+ */
public Object perform(InvocationContext ctx) throws Throwable
{
if (buddyManager != null)
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-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -43,6 +43,13 @@
this.buddyManager = manager;
}
+ /**
+ * This method calls the relevant handler on the buddy manager to deal with being
assigned to a buddy group
+ *
+ * @param ctx invocation context, ignored.
+ * @return null
+ * @throws Throwable in the event of problems
+ */
public Object perform(InvocationContext ctx) throws Throwable
{
if (buddyManager != null)
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-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -5,9 +5,9 @@
import org.jboss.cache.DataContainer;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.DataCommand;
+import org.jboss.cache.commands.read.ExistsCommand;
import org.jboss.cache.commands.read.GetChildrenNamesCommand;
import org.jboss.cache.commands.read.GetDataMapCommand;
-import org.jboss.cache.commands.read.RemoteExistsCommand;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.InterceptorChain;
@@ -56,10 +56,10 @@
}
/**
- * A 'clustered get' call, called from a remote ClusteredCacheLoader.
+ * Invokes a {@link org.jboss.cache.commands.DataCommand} on a remote cache and
returns results.
*
- * @return a List containing 2 elements: (true or false) and a value (Object). If
buddy replication
- * is used one further element is added - an Fqn of the backup subtree in
which this node may be found.
+ * @param context invocation context, ignored.
+ * @return a List containing 2 elements: a boolean, (true or false) and a value
(Object) which is the result of invoking a remote get specified by {@link
#getDataCommand()}. If buddy replication is used one further element is added - an Fqn of
the backup subtree in which this node may be found.
*/
public Object perform(InvocationContext context) throws Throwable
{
@@ -111,7 +111,7 @@
{
return callResults != null &&
dataContainer.exists(dataCommand.getFqn());
}
- return dataCommand instanceof RemoteExistsCommand && (Boolean)
callResults;
+ return dataCommand instanceof ExistsCommand && (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-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -70,6 +70,13 @@
this.dataContainer = dataContainer;
}
+ /**
+ * Performs a cleanup on nodes that would have been previously gravitated away from
the current cache instance.
+ *
+ * @param ctx invocation context, ignored
+ * @return null
+ * @throws Throwable
+ */
public Object perform(InvocationContext ctx) throws Throwable
{
if (buddyManager.isDataGravitationRemoveOnFind())
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-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -35,6 +35,12 @@
this.buddyManager = buddyManager;
}
+ /**
+ * This method calls the relevant handler on the buddy manager to deal with being
removed from a buddy group
+ *
+ * @param ctx invocation context, ignored.
+ * @return null
+ */
public Object perform(InvocationContext ctx)
{
if (buddyManager != null)
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-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -83,9 +83,27 @@
this.modifications = modifications;
}
+ /**
+ * Executes commands replicated to the current cache instance by other cache
instances.
+ *
+ * @param ctx invocation context, ignored.
+ * @return if this is a single command being processed <b>and</b> it is a
{@link org.jboss.cache.commands.read.GravitateDataCommand}, the result of processing this
command is returned. Otherwise, null is returned.
+ * @throws Throwable
+ */
public Object perform(InvocationContext ctx) throws Throwable
{
- if (isSingleCommand()) return processSingleCommand(singleModification);
+ if (isSingleCommand())
+ {
+ Object retVal = processSingleCommand(singleModification);
+
+ // only send back the result of the execution if it is a data gravitation
command.
+ // all other commands don't need to send back return values, there will be
an unnecessary overhead of
+ // marshalling results that won't ever be used.
+ if (singleModification instanceof GravitateDataCommand)
+ return retVal;
+ else
+ return null;
+ }
for (ReplicableCommand command : modifications) processSingleCommand(command);
return null;
}
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-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/tx/AbstractTransactionCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -17,7 +17,7 @@
protected GlobalTransaction globalTransaction;
/**
- * Default implementation which is a no-op.
+ * Default implementation which is a no-op. Transaction boundary commands always
return a null.
*
* @return null
*/
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/CreateNodeCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/write/CreateNodeCommand.java 2008-04-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/CreateNodeCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -47,6 +47,13 @@
return null;
}
+ /**
+ * Creates a node in the cache, specified by the given Fqn.
+ *
+ * @param ctx invocation context
+ * @return a Node
+ * @throws Throwable in the event of problems
+ */
public Object perform(InvocationContext ctx) throws Throwable
{
Object[] results = dataContainer.createNodes(fqn);
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-04-29
14:17:19 UTC (rev 5752)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -26,10 +26,13 @@
}
/**
- * Returns false if the node still exists; i.e. was only data removed because it still
has children.
+ * Evicts a node.
* <p/>
* See {@link
org.jboss.cache.interceptors.EvictionInterceptor#visitEvictFqnCommand(org.jboss.cache.InvocationContext,
EvictCommand)}
- * which is where this return value is used
+ * which is where the return value is used
+ *
+ * @param ctx invocaton context
+ * @return true if the node was removed from the tree. Returns false if the node
still exists; i.e. was only data removed because it still has children.
*/
public Object perform(InvocationContext ctx)
{
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-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/InvalidateCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -63,6 +63,12 @@
this.isOptimisticLocking = configuration.isNodeLockingOptimistic();
}
+ /**
+ * Performs an invalidation on a specified node
+ *
+ * @param ctx invocation context
+ * @return null
+ */
@Override
public Object perform(InvocationContext ctx)
{
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-04-29
14:17:19 UTC (rev 5752)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -58,6 +58,12 @@
this.globalTransaction = globalTransaction;
}
+ /**
+ * Moves a node, from <tt>fqn</tt> to <tt>to</tt>, and returns
null.
+ *
+ * @param ctx invocation context
+ * @return null
+ */
public Object perform(InvocationContext ctx)
{
move(fqn, to, false, ctx);
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java 2008-04-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -51,6 +51,13 @@
this.eraseContents = eraseContents;
}
+ /**
+ * Adds the provided data map to the data map in the node referenced by the specified
Fqn, optionally erasing the node's
+ * data first (if {@link #isEraseContents()} is <tt>true</tt>).
+ *
+ * @param ctx invocation context
+ * @return null
+ */
public Object perform(InvocationContext ctx)
{
if (trace)
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java 2008-04-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -54,6 +54,12 @@
this.putForExternalRead = putForExternalRead;
}
+ /**
+ * Puts the specified key and value into the data map in the node referenced by the
specified Fqn.
+ *
+ * @param ctx invocation context
+ * @return the value being overwritten, if any, otherwise a null.
+ */
public Object perform(InvocationContext ctx)
{
if (trace)
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveDataCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveDataCommand.java 2008-04-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveDataCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -48,6 +48,12 @@
this.eviction = eviction;
}
+ /**
+ * Clears the data map in the node referenced by the specified Fqn.
+ *
+ * @param ctx invocation context
+ * @return null
+ */
public Object perform(InvocationContext ctx)
{
if (trace) log.trace("perform(" + globalTransaction + ",
\"" + fqn + "\")");
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java 2008-04-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -46,6 +46,12 @@
this.createUndoOps = createUndoOps;
}
+ /**
+ * Removes the specified key from the data map in the node referenced by the specified
Fqn.
+ *
+ * @param ctx invocation context
+ * @return the value being removed, if any, otherwise a null.
+ */
public Object perform(InvocationContext ctx)
{
if (trace) log.trace("perform(" + globalTransaction + ",
\"" + fqn + "\", key=" + key + ")");
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-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -48,6 +48,12 @@
this.eviction = eviction;
}
+ /**
+ * Removes the node referenced by the specified Fqn.
+ *
+ * @param ctx invocation context
+ * @return true if the node was found and removed, false otherwise.
+ */
public Object perform(InvocationContext ctx)
{
NodeSPI parentNode;
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-29
14:17:19 UTC (rev 5752)
+++ core/trunk/src/main/java/org/jboss/cache/factories/CommandsFactory.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -7,13 +7,13 @@
import org.jboss.cache.commands.DataCommand;
import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.ReversibleCommand;
+import org.jboss.cache.commands.read.ExistsCommand;
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.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
-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;
@@ -178,9 +178,9 @@
return command;
}
- public RemoteExistsCommand buildExistsNodeCommand(Fqn fqn)
+ public ExistsCommand buildExistsNodeCommand(Fqn fqn)
{
- RemoteExistsCommand command = new RemoteExistsCommand(fqn);
+ ExistsCommand command = new ExistsCommand(fqn);
registry.wireDependencies(command);
return command;
}
@@ -295,8 +295,8 @@
ReplicableCommand returnValue;
switch (id)
{
- case RemoteExistsCommand.METHOD_ID:
- returnValue = new RemoteExistsCommand();
+ case ExistsCommand.METHOD_ID:
+ returnValue = new ExistsCommand();
break;
case GetChildrenNamesCommand.METHOD_ID:
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-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -16,13 +16,13 @@
import org.jboss.cache.buddyreplication.GravitateResult;
import org.jboss.cache.commands.DataCommand;
import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.commands.read.ExistsCommand;
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.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
-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 visitExistsNodeCommand(InvocationContext ctx, RemoteExistsCommand
command) throws Throwable
+ public Object visitExistsNodeCommand(InvocationContext ctx, ExistsCommand command)
throws Throwable
{
return handleGetMethod(ctx, command);
}
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/base/PostProcessingCommandInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/base/PostProcessingCommandInterceptor.java 2008-04-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/base/PostProcessingCommandInterceptor.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -2,13 +2,13 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.VisitableCommand;
+import org.jboss.cache.commands.read.ExistsCommand;
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.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
-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;
@@ -182,7 +182,7 @@
}
@Override
- public final Object visitExistsNodeCommand(InvocationContext ctx, RemoteExistsCommand
command) throws Throwable
+ public final Object visitExistsNodeCommand(InvocationContext ctx, ExistsCommand
command) throws Throwable
{
try
{
@@ -194,7 +194,7 @@
}
}
- protected Object handleExistsNodeCommand(InvocationContext ctx, RemoteExistsCommand
command) throws Throwable
+ protected Object handleExistsNodeCommand(InvocationContext ctx, ExistsCommand command)
throws Throwable
{
return handleDefault(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-29
14:17:19 UTC (rev 5752)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -2,13 +2,13 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.VisitableCommand;
+import org.jboss.cache.commands.read.ExistsCommand;
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.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
-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;
@@ -159,7 +159,7 @@
}
@Override
- public final Object visitExistsNodeCommand(InvocationContext ctx, RemoteExistsCommand
command) throws Throwable
+ public final Object visitExistsNodeCommand(InvocationContext ctx, ExistsCommand
command) throws Throwable
{
if (skipInterception(ctx, command))
{
@@ -168,7 +168,7 @@
return handleExistsNodeCommand(ctx, command);
}
- protected Object handleExistsNodeCommand(InvocationContext ctx, RemoteExistsCommand
command) throws Throwable
+ protected Object handleExistsNodeCommand(InvocationContext ctx, ExistsCommand command)
throws Throwable
{
return handleAll(ctx, command);
}
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-29
14:17:19 UTC (rev 5752)
+++ core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -15,10 +15,10 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.RegionManager;
import org.jboss.cache.commands.DataCommand;
+import org.jboss.cache.commands.read.ExistsCommand;
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.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
{
- RemoteExistsCommand command = commandsFactory.buildExistsNodeCommand(name);
+ ExistsCommand command = commandsFactory.buildExistsNodeCommand(name);
Object resp = callRemote(command);
return resp != null && (Boolean) resp;
}
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-29
14:17:19 UTC (rev 5752)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java 2008-04-29
14:28:51 UTC (rev 5753)
@@ -15,12 +15,12 @@
import org.jboss.cache.commands.DataCommand;
import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.ReversibleCommand;
+import org.jboss.cache.commands.read.ExistsCommand;
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.GetKeysCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
-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;
@@ -150,7 +150,7 @@
case GetDataMapCommand.METHOD_ID:
case GetKeyValueCommand.METHOD_ID:
case GetKeysCommand.METHOD_ID:
- case RemoteExistsCommand.METHOD_ID:
+ case ExistsCommand.METHOD_ID:
fqn = ((DataCommand) cmd).getFqn();
break;