JBoss Cache SVN: r4986 - core/trunk/src/main/java/org/jboss/cache/interceptors.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-04 11:55:01 -0500 (Fri, 04 Jan 2008)
New Revision: 4986
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.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/Interceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
Log:
JBCACHE-811 - more efficiencies with peek()
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-01-04 16:20:23 UTC (rev 4985)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-01-04 16:55:01 UTC (rev 4986)
@@ -177,7 +177,7 @@
private void removeNodeFromCacheLoader(InvocationContext ctx, Fqn fqn) throws Throwable
{
NodeSPI n;
- if (((n = peekNode(ctx, fqn, false, true)) != null) && n.isDataLoaded() && loader.exists(fqn))
+ if (((n = peekNode(ctx, fqn, false, true, false)) != null) && n.isDataLoaded() && loader.exists(fqn))
{
// node not null and attributes have been loaded?
if (!n.getChildrenDirect().isEmpty())
@@ -339,9 +339,9 @@
// AND it was found in the cache loader (nodeLoaded = true).
// Then notify the listeners that the node has been activated.
Fqn fqn = (Fqn) args[1];
- if (fqn != null && peekNode(ctx, fqn, false, false) != null && loader.exists(fqn))
+ if (fqn != null && peekNode(ctx, fqn, false, false, false) != null && loader.exists(fqn))
{
- NodeSPI n = peekNode(ctx, fqn, false, true);// don't load
+ NodeSPI n = peekNode(ctx, fqn, false, true, false);// don't load
// node not null and attributes have been loaded?
if (n != null && n.isDataLoaded())
{
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-01-04 16:20:23 UTC (rev 4985)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-01-04 16:55:01 UTC (rev 4986)
@@ -265,7 +265,7 @@
private void loadIfNeeded(InvocationContext ctx, Fqn fqn, Object key, boolean allKeys, boolean initNode, boolean acquireLock, MethodCall m, TransactionEntry entry, boolean recursive, boolean isMove, boolean bypassLoadingData) throws Throwable
{
- NodeSPI n = cache.peek(fqn, true, true);
+ NodeSPI n = peekNode(ctx, fqn, false, true, true);
boolean mustLoad = mustLoad(n, key, allKeys);
if (trace)
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2008-01-04 16:20:23 UTC (rev 4985)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2008-01-04 16:55:01 UTC (rev 4986)
@@ -112,7 +112,7 @@
Set<Fqn> affectedFqns = preparingTxs.remove(gtx);
if (affectedFqns != null)
{
- storeInternalState(affectedFqns);
+ storeInternalState(ctx, affectedFqns);
}
return returnValue;
}
@@ -212,7 +212,7 @@
{
loader.removeData(fqn);
// we need to mark this node as data loaded
- NodeSPI n = peekNode(ctx, fqn, false, false);//cache.peek(fqn, false);
+ NodeSPI n = peekNode(ctx, fqn, false, false, false);//cache.peek(fqn, false);
if (n != null)
{
n.setDataLoaded(true);
@@ -245,7 +245,7 @@
}
loader.removeData(fqn);
// if we are erasing all the data then consider this node loaded
- NodeSPI n = peekNode(ctx, fqn, false, false);//cache.peek(fqn, false);
+ NodeSPI n = peekNode(ctx, fqn, false, false, false);//cache.peek(fqn, false);
n.setDataLoaded(true);
return returnValue;
}
@@ -299,14 +299,14 @@
return tx_mgr != null && tx_mgr.getTransaction() != null;
}
- private void storeInternalState(Set<Fqn> affectedFqns) throws Exception
+ private void storeInternalState(InvocationContext ctx, Set<Fqn> affectedFqns) throws Exception
{
if (cache.getConfiguration().isNodeLockingOptimistic())
{
for (Fqn f : affectedFqns)
{
// NOT going to store tombstones!!
- NodeSPI n = cache.peek(f, false, false);
+ NodeSPI n = peekNode(ctx, f, false, false, false);
if (n != null)
{
Map internalState = n.getInternalState(true);
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-01-04 16:20:23 UTC (rev 4985)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-01-04 16:55:01 UTC (rev 4986)
@@ -172,7 +172,7 @@
}
else
{
- if (peekNode(ctx, fqn, false, false) == null)
+ if (peekNode(ctx, fqn, false, false, false) == null)
{
if (trace) log.trace("Gravitating from local backup tree");
BackupData data = localBackupGet(fqn, ctx);
@@ -386,7 +386,7 @@
if (localOnly)
{
// if (cache.peek(data.getFqn(), false) == null)
- if (peekNode(ctx, data.getFqn(), false, false) == null)
+ if (peekNode(ctx, data.getFqn(), false, false, false) == null)
{
createNodesLocally(data.getFqn(), data.getAttributes());
}
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-01-04 16:20:23 UTC (rev 4985)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-01-04 16:55:01 UTC (rev 4986)
@@ -238,7 +238,7 @@
return;
}
- NodeSPI<?, ?> nodeSPI = peekNode(ctx, event.getFqn(), false, false);//cache.peek(event.getFqn(), false);
+ NodeSPI<?, ?> nodeSPI = peekNode(ctx, event.getFqn(), false, false, false);//cache.peek(event.getFqn(), false);
//we do not trigger eviction events for resident nodes
if (nodeSPI != null && nodeSPI.isResident())
{
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java 2008-01-04 16:20:23 UTC (rev 4985)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/Interceptor.java 2008-01-04 16:55:01 UTC (rev 4986)
@@ -231,20 +231,25 @@
* @param f fqn to find
* @param forceRefresh forces calling cache.peek() even if we hold a reference to the relevant node.
* @param includeDeletedNodes includes nodes marked for deletion if this is true
+ * @param includeInvalidNodes includes nodes marked as invalid if this is true
* @return a node, or null if one cannot be found.
* @since 2.1.0
*/
- public NodeSPI peekNode(InvocationContext ctx, Fqn f, boolean forceRefresh, boolean includeDeletedNodes)
+ public NodeSPI peekNode(InvocationContext ctx, Fqn f, boolean forceRefresh, boolean includeDeletedNodes, boolean includeInvalidNodes)
{
NodeSPI n;
if (forceRefresh || (n = ctx.getPeekedNode(f)) == null)
{
- n = cache.peek(f, true);
+ n = cache.peek(f, true, true);
// put this in the invocation cache
ctx.savePeekedNode(n, f);
}
- if (n != null && !includeDeletedNodes && n.isDeleted()) return null;
+ if (n != null)
+ {
+ if (!includeDeletedNodes && n.isDeleted()) return null;
+ if (!includeInvalidNodes && !n.isValid()) return null;
+ }
return n;
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2008-01-04 16:20:23 UTC (rev 4985)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2008-01-04 16:55:01 UTC (rev 4986)
@@ -114,7 +114,7 @@
fqns.add((Fqn) to);
// peek into Node and get a hold of all child fqns as these need to be in the workspace.
- NodeSPI node = cache.peek((Fqn) from, true, true);
+ NodeSPI node = peekNode(ctx, (Fqn) from, false, true, true);
greedyGetFqns(fqns, node, (Fqn) to);
@@ -137,7 +137,7 @@
private void createNode(InvocationContext ctx, Fqn targetFqn, boolean suppressNotification) throws CacheException
{
// if (cache.peek(targetFqn, false) != null) return;
- if (peekNode(ctx, targetFqn, false, false) != null) return;
+ if (peekNode(ctx, targetFqn, false, false, false) != null) return;
// we do nothing if targetFqn is null
if (targetFqn == null) return;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-01-04 16:20:23 UTC (rev 4985)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-01-04 16:55:01 UTC (rev 4986)
@@ -69,12 +69,12 @@
GlobalTransaction gtx = getGlobalTransaction(ctx);
TransactionWorkspace workspace = getTransactionWorkspace(gtx);
Fqn fqn = getFqn(args, m.getMethodId());
- WorkspaceNode workspaceNode = fetchWorkspaceNode(fqn, workspace, true, true);
+ WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, fqn, workspace, true, true);
// in the case of a data gravitation cleanup, if the primary Fqn does not exist the backup one may.
if (workspaceNode == null && m.getMethodId() == MethodDeclarations.dataGravitationCleanupMethod_id)
{
- workspaceNode = fetchWorkspaceNode(getBackupFqn(args), workspace, true, true);
+ workspaceNode = fetchWorkspaceNode(ctx, getBackupFqn(args), workspace, true, true);
}
if (workspaceNode != null)
@@ -238,7 +238,7 @@
return;
}
- WorkspaceNode oldParent = fetchWorkspaceNode(nodeFqn.getParent(), ws, false, true);
+ WorkspaceNode oldParent = fetchWorkspaceNode(ctx, nodeFqn.getParent(), ws, false, true);
if (oldParent == null) throw new NodeNotExistsException("Node " + nodeFqn.getParent() + " does not exist!");
if (parentFqn.equals(oldParent.getFqn()))
@@ -247,7 +247,7 @@
return;
}
// retrieve parent
- WorkspaceNode parent = fetchWorkspaceNode(parentFqn, ws, false, true);
+ WorkspaceNode parent = fetchWorkspaceNode(ctx, parentFqn, ws, false, true);
if (parent == null) throw new NodeNotExistsException("Node " + parentFqn + " does not exist!");
Object nodeName = nodeFqn.getLastElement();
@@ -262,7 +262,7 @@
// pre-notify
notifier.notifyNodeMoved(nodeFqn, nodeNewFqn, true, ctx);
- recursiveMoveNode(node, parent.getFqn(), ws);
+ recursiveMoveNode(ctx, node, parent.getFqn(), ws);
// remove old nodes. this may mark some nodes which have already been moved as deleted
removeNode(ws, node, false, ctx);
@@ -278,17 +278,17 @@
* @param newBase new base Fqn under which the given node will now exist
* @param ws transaction workspace
*/
- private void recursiveMoveNode(WorkspaceNode node, Fqn newBase, TransactionWorkspace ws)
+ private void recursiveMoveNode(InvocationContext ctx, WorkspaceNode node, Fqn newBase, TransactionWorkspace ws)
{
Fqn newFqn = new Fqn(newBase, node.getFqn().getLastElement());
- WorkspaceNode movedNode = fetchWorkspaceNode(newFqn, ws, true, true);
+ WorkspaceNode movedNode = fetchWorkspaceNode(ctx, newFqn, ws, true, true);
movedNode.putAll(node.getData());
// process children
for (Object n : node.getChildrenNames())
{
- WorkspaceNode child = fetchWorkspaceNode(new Fqn(node.getFqn(), n), ws, false, true);
- if (child != null) recursiveMoveNode(child, newFqn, ws);
+ WorkspaceNode child = fetchWorkspaceNode(ctx, new Fqn(node.getFqn(), n), ws, false, true);
+ if (child != null) recursiveMoveNode(ctx, child, newFqn, ws);
}
}
@@ -329,7 +329,7 @@
if (workspaceNode == null) return false;
Fqn parentFqn = workspaceNode.getFqn().getParent();
- WorkspaceNode parentNode = fetchWorkspaceNode(parentFqn, workspace, true, true);
+ WorkspaceNode parentNode = fetchWorkspaceNode(ctx, parentFqn, workspace, true, true);
if (parentNode == null) throw new NodeNotExistsException("Unable to find parent node with fqn " + parentFqn);
// pre-notify
@@ -396,7 +396,7 @@
{
Fqn fqn = (Fqn) args[0];
Object key = args[1];
- WorkspaceNode workspaceNode = fetchWorkspaceNode(fqn, workspace, false, false);
+ WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, fqn, workspace, false, false);
if (workspaceNode == null)
{
@@ -418,7 +418,7 @@
{
Fqn fqn = (Fqn) args[0];
- WorkspaceNode workspaceNode = fetchWorkspaceNode(fqn, workspace, false, false);
+ WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, fqn, workspace, false, false);
if (workspaceNode == null)
{
@@ -443,7 +443,7 @@
{
Fqn fqn = (Fqn) args[0];
- WorkspaceNode workspaceNode = fetchWorkspaceNode(fqn, workspace, false, false);
+ WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, fqn, workspace, false, false);
if (workspaceNode == null)
{
@@ -464,7 +464,7 @@
{
Fqn fqn = (Fqn) args[0];
- WorkspaceNode workspaceNode = fetchWorkspaceNode(fqn, workspace, false, false);
+ WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, fqn, workspace, false, false);
if (workspaceNode == null)
{
@@ -485,7 +485,7 @@
{
Fqn fqn = (Fqn) args[0];
- WorkspaceNode workspaceNode = fetchWorkspaceNode(fqn, workspace, false, false);
+ WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, fqn, workspace, false, false);
if (workspaceNode == null)
{
@@ -522,13 +522,13 @@
* @param includeInvalidNodes
* @return a node, if found, or null if not.
*/
- private WorkspaceNode fetchWorkspaceNode(Fqn fqn, TransactionWorkspace workspace, boolean undeleteIfNecessary, boolean includeInvalidNodes)
+ private WorkspaceNode fetchWorkspaceNode(InvocationContext ctx, Fqn fqn, TransactionWorkspace workspace, boolean undeleteIfNecessary, boolean includeInvalidNodes)
{
WorkspaceNode workspaceNode = workspace.getNode(fqn);
// if we do not have the node then we need to add it to the workspace
if (workspaceNode == null)
{
- NodeSPI node = cache.peek(fqn, true, includeInvalidNodes);
+ NodeSPI node = peekNode(ctx, fqn, false, true, includeInvalidNodes);
if (node == null) return null;
// create new workspace node based on the node from the underlying data structure
@@ -546,7 +546,7 @@
{
workspaceNode.markAsDeleted(false);
// re-add to parent
- WorkspaceNode parent = fetchWorkspaceNode(fqn.getParent(), workspace, true, includeInvalidNodes);
+ WorkspaceNode parent = fetchWorkspaceNode(ctx, fqn.getParent(), workspace, true, includeInvalidNodes);
parent.addChild(workspaceNode);
}
else
@@ -564,7 +564,7 @@
// now make sure all parents are in the wsp as well
if (workspaceNode != null && !fqn.isRoot())
- fetchWorkspaceNode(fqn.getParent(), workspace, false, includeInvalidNodes);
+ fetchWorkspaceNode(ctx, fqn.getParent(), workspace, false, includeInvalidNodes);
return workspaceNode;
}
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java 2008-01-04 16:20:23 UTC (rev 4985)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java 2008-01-04 16:55:01 UTC (rev 4986)
@@ -78,7 +78,7 @@
if (trace) log.trace("Validating version for node [" + fqn + "]");
NodeSPI underlyingNode;
- underlyingNode = cache.peek(fqn, true, true);
+ underlyingNode = peekNode(ctx, fqn, false, true, true);
// if this is a newly created node then we expect the underlying node to be null.
// also, if the node has been deleted in the WS and the underlying node is null, this *may* be ok ... will test again later when comparing versions
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-01-04 16:20:23 UTC (rev 4985)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-01-04 16:55:01 UTC (rev 4986)
@@ -94,7 +94,7 @@
{
throw new NodeNotLoadedException();
}
- NodeSPI n = peekNode(ctx, fqn, false, true);
+ NodeSPI n = peekNode(ctx, fqn, false, true, false);
if (n != null)
{
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-01-04 16:20:23 UTC (rev 4985)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-01-04 16:55:01 UTC (rev 4986)
@@ -134,7 +134,7 @@
if (recursive)
{
//acquireLocksOnChildren(cache.peek(fqn, false), lockType, ctx);
- acquireLocksOnChildren(peekNode(ctx, fqn, false, false), lockType, ctx);
+ acquireLocksOnChildren(peekNode(ctx, fqn, false, false, false), lockType, ctx);
}
return null;
}
@@ -209,18 +209,18 @@
{
cache.getTransactionTable().get(ctx.getGlobalTransaction()).addRemovedNode(from);
}
- acquireLocksOnChildren(peekNode(ctx, from, false, true), NodeLock.LockType.WRITE, ctx);
+ acquireLocksOnChildren(peekNode(ctx, from, false, true, false), NodeLock.LockType.WRITE, ctx);
}
if (to != null && !(configuration.getIsolationLevel() == IsolationLevel.NONE))
{
//now for an RL for the new parent.
if (trace) log.trace("Attempting to get RL on new parent [" + to + "]");
lock(ctx, to, NodeLock.LockType.READ, false, timeout, false, false);
- acquireLocksOnChildren(peekNode(ctx, to, false, true), NodeLock.LockType.READ, ctx);
+ acquireLocksOnChildren(peekNode(ctx, to, false, true, false), NodeLock.LockType.READ, ctx);
}
Object retValue = nextInterceptor(ctx);
// do a REAL remove here.
- NodeSPI n = peekNode(ctx, from, false, true);
+ NodeSPI n = peekNode(ctx, from, false, true, false);
if (n != null)
{
n.getLock().releaseAll(Thread.currentThread());
@@ -240,7 +240,7 @@
if (ctx.getGlobalTransaction() == null)
{
cacheImpl.realRemove(fqn, true);
- NodeSPI n = peekNode(ctx, fqn, false, true);
+ NodeSPI n = peekNode(ctx, fqn, false, true, false);
if (n != null)
{
n.getLock().releaseAll(Thread.currentThread());
@@ -337,7 +337,7 @@
created = lock(ctx, fqn, lockType, createIfNotExists, timeout, acquireLockOnParent, reverseRemoveCheck);
firstTry = false;
}
- while (createIfNotExists && peekNode(ctx, fqn, false, true) == null);// keep trying until we have the lock (fixes concurrent remove())
+ while (createIfNotExists && peekNode(ctx, fqn, false, true, false) == null);// keep trying until we have the lock (fixes concurrent remove())
return created;
}
@@ -401,7 +401,7 @@
// make sure the lock we acquired isn't on a deleted node/is an orphan!!
// look into invalidated nodes as well
- NodeSPI repeek = cache.peek(currentNode.getFqn(), true, true);
+ NodeSPI repeek = peekNode(ctx, currentNode.getFqn(), true, true, true);
if (currentNode != repeek)
{
if (trace)
@@ -410,7 +410,7 @@
// check if the parent exists!!
// look into invalidated nodes as well
currentNode.getLock().releaseAll(owner);
- if (cache.peek(parent.getFqn(), true, true) == null)
+ if (peekNode(ctx, parent.getFqn(), true, true, true) == null)
{
// crap!
if (trace)
@@ -490,7 +490,7 @@
{
return true;// we're doing a remove and we've reached the PARENT node of the target to be removed.
}
- if (!isTargetNode && peekNode(ctx, targetFqn.getAncestor(currentNodeIndex + 2), false, false) == null)
+ if (!isTargetNode && peekNode(ctx, targetFqn.getAncestor(currentNodeIndex + 2), false, false, false) == null)
//if (!isTargetNode && cache.peek(targetFqn.getAncestor(currentNodeIndex + 2), false) == null)
//if (!isTargetNode && cache.peek(new Fqn(currentNode.getFqn(), targetFqn.get(currentNodeIndex + 1)), false) == null)
{
16 years, 11 months
JBoss Cache SVN: r4985 - cache-bench-fwk/trunk/src/org/cachebench/smartfrog.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-01-04 11:20:23 -0500 (Fri, 04 Jan 2008)
New Revision: 4985
Modified:
cache-bench-fwk/trunk/src/org/cachebench/smartfrog/CacheBenchmarkPrim.java
Log:
the Prim was enhanced to log the output of the run script
Modified: cache-bench-fwk/trunk/src/org/cachebench/smartfrog/CacheBenchmarkPrim.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/smartfrog/CacheBenchmarkPrim.java 2008-01-04 15:57:04 UTC (rev 4984)
+++ cache-bench-fwk/trunk/src/org/cachebench/smartfrog/CacheBenchmarkPrim.java 2008-01-04 16:20:23 UTC (rev 4985)
@@ -7,7 +7,10 @@
import org.smartfrog.sfcore.prim.PrimImpl;
import org.smartfrog.sfcore.prim.TerminationRecord;
+import java.io.BufferedReader;
import java.io.File;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
import java.rmi.RemoteException;
/**
@@ -56,6 +59,13 @@
String command = scriptToExec + " " + nodeIndex + " " + cacheDistribution + " -DclusterSize=" + clusterSize;
log.info("Executing command: " + command);
Process process = Runtime.getRuntime().exec(command, null, toRunIn);
+ InputStreamReader reader = new InputStreamReader(process.getInputStream());
+ BufferedReader bufferedReader = new LineNumberReader(reader);
+ String line;
+ while ((line = bufferedReader.readLine()) != null)
+ {
+ log.debug(scriptToExec + ">>>" + line);
+ }
int exitValue = process.waitFor();
if (exitValue != 0)
{
16 years, 11 months
JBoss Cache SVN: r4984 - in core/trunk/src/main/java/org/jboss/cache: marshall and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-04 10:57:04 -0500 (Fri, 04 Jan 2008)
New Revision: 4984
Modified:
core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/marshall/MethodCall.java
Log:
JBCACHE-1230 - reduced noisy toString() impls
Modified: core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2008-01-04 15:56:39 UTC (rev 4983)
+++ core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2008-01-04 15:57:04 UTC (rev 4984)
@@ -1910,7 +1910,7 @@
if (trace)
{
- log.trace("callRemoteMethods(): valid members are " + validMembers + " methods: " + method_call.getArgs()[0]);
+ log.trace("callRemoteMethods(): valid members are " + validMembers + " methods: " + method_call);
}
if (channel.flushSupported())
@@ -1927,7 +1927,7 @@
if (rsps == null)
{
// return null;
- throw new NotSerializableException("RpcDispatcher returned a null. This is most often caused by args for " + method_call + " not being serializable.");
+ throw new NotSerializableException("RpcDispatcher returned a null. This is most often caused by args for " + method_call.getName() + " not being serializable.");
}
if (mode == GroupRequest.GET_NONE)
{
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-01-04 15:56:39 UTC (rev 4983)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-01-04 15:57:04 UTC (rev 4984)
@@ -332,7 +332,7 @@
@Override
public String toString()
{
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
if (!valid) sb.append(" (INVALID!) ");
@@ -348,12 +348,61 @@
{
synchronized (data)
{
- sb.append(" data=").append(data.keySet());
+ sb.append(" data=[");
+ Set keys = data.keySet();
+ int i = 0;
+ for (Object o : keys)
+ {
+ i++;
+ sb.append(o);
+
+ if (i == 5)
+ {
+ int more = keys.size() - 5;
+ if (more > 1)
+ {
+ sb.append(", and ");
+ sb.append(more);
+ sb.append(" more");
+ break;
+ }
+ }
+ else
+ {
+ sb.append(", ");
+ }
+ }
+ sb.append("]");
}
}
if (children != null && !children.isEmpty())
{
- sb.append(" child=").append(getChildrenNamesDirect());
+ sb.append(" children=[");
+ Set names = getChildrenNamesDirect();
+ int i = 0;
+ for (Object o : names)
+ {
+ i++;
+ sb.append(o);
+
+ if (i == 5)
+ {
+ int more = names.size() - 5;
+ if (more > 1)
+ {
+ sb.append(", and ");
+ sb.append(more);
+ sb.append(" more");
+ break;
+ }
+ }
+ else
+ {
+ sb.append(", ");
+ }
+ }
+ sb.append("]");
+
}
if (lock_ != null)
{
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/MethodCall.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/MethodCall.java 2008-01-04 15:56:39 UTC (rev 4983)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/MethodCall.java 2008-01-04 15:57:04 UTC (rev 4984)
@@ -37,21 +37,21 @@
// for serialization
}
- /**
- * This only works for prepare() and optimisticPrepare() method calls.
- */
- public boolean isOnePhaseCommitPrepareMehod()
- {
- switch (this.getMethodId())
- {
- case MethodDeclarations.prepareMethod_id:
- return (Boolean) this.getArgs()[3];
- case MethodDeclarations.optimisticPrepareMethod_id:
- return (Boolean) this.getArgs()[4];
- default:
- return false;
- }
- }
+ /**
+ * This only works for prepare() and optimisticPrepare() method calls.
+ */
+ public boolean isOnePhaseCommitPrepareMehod()
+ {
+ switch (this.getMethodId())
+ {
+ case MethodDeclarations.prepareMethod_id:
+ return (Boolean) this.getArgs()[3];
+ case MethodDeclarations.optimisticPrepareMethod_id:
+ return (Boolean) this.getArgs()[4];
+ default:
+ return false;
+ }
+ }
protected MethodCall(Method method, Object... arguments)
@@ -90,23 +90,13 @@
ret.append("; MethodIdInteger: ");
ret.append(methodIdInteger);
ret.append("; Args: (");
- if (args != null)
+ if (args != null && args.length > 0)
{
- for (Object arg : args)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- ret.append(", ");
- }
- ret.append(arg);
- }
+ ret.append(" arg[0] = ");
+ ret.append(args[0]);
+ if (args.length > 1) ret.append(" ...");
}
ret.append(')');
return ret.toString();
-
}
}
16 years, 11 months
JBoss Cache SVN: r4983 - in core/branches/1.4.X/src/org/jboss/cache: marshall and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-04 10:56:39 -0500 (Fri, 04 Jan 2008)
New Revision: 4983
Modified:
core/branches/1.4.X/src/org/jboss/cache/Node.java
core/branches/1.4.X/src/org/jboss/cache/TreeCache.java
core/branches/1.4.X/src/org/jboss/cache/marshall/JBCMethodCall.java
Log:
JBCACHE-1230 - reduced noisy toString() implementations
Modified: core/branches/1.4.X/src/org/jboss/cache/Node.java
===================================================================
--- core/branches/1.4.X/src/org/jboss/cache/Node.java 2008-01-04 14:38:52 UTC (rev 4982)
+++ core/branches/1.4.X/src/org/jboss/cache/Node.java 2008-01-04 15:56:39 UTC (rev 4983)
@@ -445,7 +445,31 @@
synchronized (this)
{
if (data != null)
- sb.append("\ndata=" + data);
+ sb.append("\ndata=[");
+ Set keys = data.keySet();
+ int i=0;
+ for (Iterator it = keys.iterator(); it.hasNext();)
+ {
+ i++;
+ sb.append(it.next());
+
+ if (i == 5)
+ {
+ int more = keys.size() - 5;
+ if (more > 1)
+ {
+ sb.append(", and ");
+ sb.append(more);
+ sb.append(" more");
+ break;
+ }
+ }
+ else
+ {
+ sb.append(", ");
+ }
+ }
+ sb.append("]");
}
if (lock_ != null)
{
Modified: core/branches/1.4.X/src/org/jboss/cache/TreeCache.java
===================================================================
--- core/branches/1.4.X/src/org/jboss/cache/TreeCache.java 2008-01-04 14:38:52 UTC (rev 4982)
+++ core/branches/1.4.X/src/org/jboss/cache/TreeCache.java 2008-01-04 15:56:39 UTC (rev 4983)
@@ -4422,7 +4422,7 @@
if (rsps == null)
{
// return null;
- throw new NotSerializableException("RpcDispatcher returned a null. This is most often caused by args for " + method_call + " not being serializable.");
+ throw new NotSerializableException("RpcDispatcher returned a null. This is most often caused by args for " + method_call.getName() + " not being serializable.");
}
if (mode == GroupRequest.GET_NONE)
Modified: core/branches/1.4.X/src/org/jboss/cache/marshall/JBCMethodCall.java
===================================================================
--- core/branches/1.4.X/src/org/jboss/cache/marshall/JBCMethodCall.java 2008-01-04 14:38:52 UTC (rev 4982)
+++ core/branches/1.4.X/src/org/jboss/cache/marshall/JBCMethodCall.java 2008-01-04 15:56:39 UTC (rev 4983)
@@ -65,17 +65,12 @@
ret.append(method_name);
ret.append("; id:");
ret.append(methodId);
- ret.append('(');
- if (args != null)
+ ret.append("; Args: (");
+ if (args != null && args.length > 0)
{
- for (int i = 0; i < args.length; i++)
- {
- if (first)
- first = false;
- else
- ret.append(", ");
- ret.append(args[i]);
- }
+ ret.append(" arg[0] = ");
+ ret.append(args[0]);
+ if (args.length > 1) ret.append(" ...");
}
ret.append(')');
return ret.toString();
16 years, 11 months
JBoss Cache SVN: r4982 - core/trunk/src/test/java/org/jboss/cache/optimistic.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-04 09:38:52 -0500 (Fri, 04 Jan 2008)
New Revision: 4982
Modified:
core/trunk/src/test/java/org/jboss/cache/optimistic/MockFailureInterceptor.java
core/trunk/src/test/java/org/jboss/cache/optimistic/MockInterceptor.java
core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java
Log:
Patched some tests that should expect ids instead of methods
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/MockFailureInterceptor.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/MockFailureInterceptor.java 2008-01-04 14:24:13 UTC (rev 4981)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/MockFailureInterceptor.java 2008-01-04 14:38:52 UTC (rev 4982)
@@ -20,7 +20,8 @@
public class MockFailureInterceptor extends Interceptor
{
private List<Method> allCalled = new ArrayList<Method>();
- private List failurelist = new ArrayList();
+ private List<Method> failurelist = new ArrayList<Method>();
+ private List<Integer> allCalledIdsList = new ArrayList<Integer>();
@Override
public Object invoke(InvocationContext ctx) throws Throwable
@@ -30,6 +31,7 @@
{
if (failurelist.contains(m.getMethod())) throw new Exception("Failure in method " + m);
allCalled.add(m.getMethod());
+ allCalledIdsList.add(m.getMethodId());
}
return null;
@@ -38,7 +40,7 @@
/**
* @return Returns the failurelist.
*/
- public List getFailurelist()
+ public List<Method> getFailurelist()
{
return failurelist;
}
@@ -46,7 +48,7 @@
/**
* @param failurelist The failurelist to set.
*/
- public void setFailurelist(List failurelist)
+ public void setFailurelist(List<Method> failurelist)
{
this.failurelist = failurelist;
}
@@ -66,4 +68,9 @@
{
this.allCalled = called;
}
+
+ public List<Integer> getAllCalledIds()
+ {
+ return allCalledIdsList;
+ }
}
\ No newline at end of file
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/MockInterceptor.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/MockInterceptor.java 2008-01-04 14:24:13 UTC (rev 4981)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/MockInterceptor.java 2008-01-04 14:38:52 UTC (rev 4982)
@@ -22,6 +22,7 @@
private Method called = null;
private List<Method> calledlist = new ArrayList<Method>();
+ private List<Integer> calledIdsList = new ArrayList<Integer>();
@Override
public synchronized Object invoke(InvocationContext ctx) throws Throwable
@@ -30,6 +31,7 @@
if (!MethodDeclarations.isBlockUnblockMethod(m.getMethodId()))
{
calledlist.add(m.getMethod());
+ calledIdsList.add(m.getMethodId());
called = m.getMethod();
}
@@ -49,6 +51,11 @@
return calledlist;
}
+ public List<Integer> getAllCalledIds()
+ {
+ return calledIdsList;
+ }
+
/**
* @param called The called to set.
*/
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java 2008-01-04 14:24:13 UTC (rev 4981)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java 2008-01-04 14:38:52 UTC (rev 4982)
@@ -79,7 +79,7 @@
//make sure all calls were done in right order
- List calls = dummy.getAllCalled();
+ List calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
@@ -105,7 +105,7 @@
//make sure all calls were done in right order
- List calls = dummy.getAllCalled();
+ List calls = dummy.getAllCalledIds();
assertEquals(1, calls.size());
assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(0));
@@ -166,7 +166,7 @@
//assert that the remote prepare has populated the local workspace
assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
assertEquals(1, entry.getModifications().size());
- List calls = dummy.getAllCalled();
+ List calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
@@ -230,7 +230,7 @@
assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
assertEquals(1, entry.getModifications().size());
- List calls = dummy.getAllCalled();
+ List calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
@@ -289,7 +289,7 @@
meth.getArgs()[0] = remoteGtx;
- List calls = dummy.getAllCalled();
+ List calls = dummy.getAllCalledIds();
assertEquals(2, calls.size());
@@ -350,7 +350,7 @@
meth.getArgs()[0] = remoteGtx;
- List calls = dummy.getAllCalled();
+ List calls = dummy.getAllCalledIds();
assertEquals(2, calls.size());
@@ -426,7 +426,7 @@
//assert that the remote prepare has populated the local workspace
assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
assertEquals(1, entry.getModifications().size());
- List calls = dummy.getAllCalled();
+ List calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
@@ -491,12 +491,12 @@
assertEquals(0, cache2.getTransactionTable().getNumLocalTransactions());
- List calls = dummy.getAllCalled();
+ List calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
- List calls2 = dummy2.getAllCalled();
+ List calls2 = dummy2.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls2.get(0));
assertEquals(MethodDeclarations.commitMethod_id, calls2.get(1));
@@ -554,12 +554,12 @@
assertEquals(0, cache2.getTransactionTable().getNumLocalTransactions());
- List calls = dummy.getAllCalled();
+ List calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(1));
//we have no prepare - as it failed - but we have a commit
- List calls2 = dummy2.getAllCalled();
+ List calls2 = dummy2.getAllCalledIds();
assertEquals(MethodDeclarations.rollbackMethod_id, calls2.get(0));
destroyCache(cache2);
@@ -618,11 +618,11 @@
assertEquals(0, cache2.getTransactionTable().getNumLocalTransactions());
- List calls = dummy.getAllCalled();
+ List calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(0));
//we have no prepare - as it failed - but we have a commit
- List calls2 = dummy2.getAllCalled();
+ List calls2 = dummy2.getAllCalledIds();
assertEquals(0, calls2.size());
destroyCache(cache2);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java 2008-01-04 14:24:13 UTC (rev 4981)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java 2008-01-04 14:38:52 UTC (rev 4982)
@@ -53,7 +53,7 @@
//make sure all calls were done in right order
- List<?> calls = dummy.getAllCalled();
+ List<?> calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
@@ -88,7 +88,7 @@
assertNull(mgr.getTransaction());
- List<?> calls = dummy.getAllCalled();
+ List<?> calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
@@ -119,7 +119,7 @@
assertNull(mgr.getTransaction());
- List<?> calls = dummy.getAllCalled();
+ List<?> calls = dummy.getAllCalledIds();
assertEquals(1, calls.size());
assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(0));
@@ -206,7 +206,7 @@
assertNull(mgr.getTransaction());
- List<?> calls = dummy.getAllCalled();
+ List<?> calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
boolean failed = false;
@@ -253,7 +253,7 @@
assertNull(mgr.getTransaction());
- List<?> calls = dummy.getAllCalled();
+ List<?> calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
@@ -290,7 +290,7 @@
mgr.commit();
//test local calls
- List<?> calls = dummy.getAllCalled();
+ List<?> calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
assertNull(mgr.getTransaction());
@@ -325,7 +325,7 @@
assertNotNull(table.getLocalTransaction(remoteGtx));
//assert that the method has been passed up the stack
- calls = dummy.getAllCalled();
+ calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
//assert we have the tx in th table
@@ -386,7 +386,7 @@
assertNotNull(table.getLocalTransaction(remoteGtx));
- List<?> calls = dummy.getAllCalled();
+ List<?> calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
//assert we have two current transactions
@@ -397,7 +397,7 @@
mgr.commit();
//check local calls
- calls = dummy.getAllCalled();
+ calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(1));
assertEquals(MethodDeclarations.commitMethod_id, calls.get(2));
@@ -483,7 +483,7 @@
assertNull(table.get(remoteGtx));
assertNull(table.getLocalTransaction(remoteGtx));
- List<?> calls = dummy.getAllCalled();
+ List<?> calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
@@ -493,7 +493,7 @@
//commit the local tx
mgr.commit();
- calls = dummy.getAllCalled();
+ calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
assertEquals(MethodDeclarations.commitMethod_id, calls.get(3));
@@ -571,7 +571,7 @@
assertNull(table.get(remoteGtx));
assertNull(table.getLocalTransaction(remoteGtx));
- List<?> calls = dummy.getAllCalled();
+ List<?> calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(1));
@@ -581,7 +581,7 @@
//commit the local tx
mgr.commit();
- calls = dummy.getAllCalled();
+ calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
assertEquals(MethodDeclarations.commitMethod_id, calls.get(3));
@@ -620,7 +620,7 @@
mgr.commit();
//test local calls
- List<?> calls = dummy.getAllCalled();
+ List<?> calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
@@ -660,7 +660,7 @@
//this is not populated until replication interceptor is used
assertEquals(1, table.get(remoteGtx).getModifications().size());
- calls = dummy.getAllCalled();
+ calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
assertNull(mgr.getTransaction());
@@ -712,7 +712,7 @@
mgr.commit();
//test local calls
- List<?> calls = dummy.getAllCalled();
+ List<?> calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
@@ -744,7 +744,7 @@
//this is not populated until replication interceptor is used
assertEquals(1, table.get(remoteGtx).getModifications().size());
- calls = dummy.getAllCalled();
+ calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
// call our remote method
@@ -758,7 +758,7 @@
fail();
}
- calls = dummy.getAllCalled();
+ calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(3));
@@ -800,7 +800,7 @@
mgr.commit();
- List<?> calls = dummy.getAllCalled();
+ List<?> calls = dummy.getAllCalledIds();
assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
16 years, 11 months
JBoss Cache SVN: r4981 - core/trunk/src/main/java/org/jboss/cache/marshall.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-04 09:24:13 -0500 (Fri, 04 Jan 2008)
New Revision: 4981
Modified:
core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller210.java
Log:
Initialised loggers in constructor
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-01-04 13:34:44 UTC (rev 4980)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-01-04 14:24:13 UTC (rev 4981)
@@ -63,6 +63,7 @@
public CacheMarshaller200()
{
+ initLogger();
}
/**
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller210.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller210.java 2008-01-04 13:34:44 UTC (rev 4980)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller210.java 2008-01-04 14:24:13 UTC (rev 4981)
@@ -1,7 +1,5 @@
package org.jboss.cache.marshall;
-import org.apache.commons.logging.LogFactory;
-
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -20,7 +18,7 @@
{
public CacheMarshaller210()
{
- log = LogFactory.getLog(CacheMarshaller210.class);
+ initLogger();
}
/**
16 years, 11 months
JBoss Cache SVN: r4980 - core/trunk/src/main/java/org/jboss/cache.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-04 08:34:44 -0500 (Fri, 04 Jan 2008)
New Revision: 4980
Modified:
core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
Log:
JBCACHE-1204 - proper behaviour of shutdown hook when other sources may trigger a shutdown - such as an MBean server, microcontainer, manual shutdown, etc.
Modified: core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2008-01-04 13:02:24 UTC (rev 4979)
+++ core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2008-01-04 13:34:44 UTC (rev 4980)
@@ -53,7 +53,6 @@
import org.jgroups.util.Rsp;
import org.jgroups.util.RspList;
-import javax.management.MBeanServerFactory;
import javax.transaction.Status;
import javax.transaction.SystemException;
import javax.transaction.Transaction;
@@ -183,6 +182,15 @@
private Interceptor interceptorChain;
private boolean trace;
+ /**
+ * Hook to shut down the cache when the JVM exits.
+ */
+ private Thread shutdownHook;
+ /**
+ * A flag that the shutdown hook sets before calling cache.stop(). Allows stop() to identify if it has been called
+ * from a shutdown hook.
+ */
+ private boolean invokedFromShutdownHook;
/**
* Constructs an uninitialized CacheImpl.
@@ -769,25 +777,26 @@
private void addShutdownHook()
{
- ArrayList al = MBeanServerFactory.findMBeanServer(null);
- if (al.size() == 0)
+ // *Always* register a shutdown hook. If cache.stop() is called manually or from an MBean server or microcontainer,
+ // cache.stop will de-register the shutdown hook to prevent shutdown from happening again when the JVM exits.
+
+ shutdownHook = new Thread()
{
- // the only MBean server is the system (JDK) server. So we need to register a shutdown hook.
- // install a VM shutdown hook
- Thread shutdownHook = new Thread()
+ public void run()
{
- public void run()
+ try
{
+ invokedFromShutdownHook = true;
CacheImpl.this.stop();
}
- };
+ finally
+ {
+ invokedFromShutdownHook = false;
+ }
+ }
+ };
- Runtime.getRuntime().addShutdownHook(shutdownHook);
- }
- else
- {
- log.trace("Running in an MBeanServer environment. Not registering a shutdown hook with the VM as the MBeanServer will handle lifecycle.");
- }
+ Runtime.getRuntime().addShutdownHook(shutdownHook);
}
/**
@@ -895,6 +904,9 @@
{
cacheStatus = CacheStatus.STOPPING;
+ // if this is called from a source other than the shutdown hook, deregister the shutdown hook.
+ if (!invokedFromShutdownHook) Runtime.getRuntime().removeShutdownHook(shutdownHook);
+
componentRegistry.stop();
// before closing the channel stop the buddy manager
16 years, 11 months
JBoss Cache SVN: r4979 - core/trunk/src/main/java/org/jboss/cache/optimistic.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-04 08:02:24 -0500 (Fri, 04 Jan 2008)
New Revision: 4979
Modified:
core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java
Log:
Lazy construction of internal collections
Modified: core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java 2008-01-04 13:01:55 UTC (rev 4978)
+++ core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java 2008-01-04 13:02:24 UTC (rev 4979)
@@ -44,8 +44,8 @@
private boolean created;
private boolean childrenModified;
private Map<Object, NodeSPI<K, V>> optimisticChildNodeMap;
- private Set<Fqn> childrenAdded = new HashSet<Fqn>();
- private Set<Fqn> childrenRemoved = new HashSet<Fqn>();
+ private Set<Fqn> childrenAdded;// = new HashSet<Fqn>();
+ private Set<Fqn> childrenRemoved;// = new HashSet<Fqn>();
private Map<K, V> optimisticDataMap;
private boolean versioningImplicit = true; // default
@@ -61,7 +61,8 @@
}
this.node = node;
this.workspace = workspace;
- optimisticDataMap = new HashMap<K, V>(node.getDataDirect());
+ Map<K, V> nodeData = node.getDataDirect();
+ if (!nodeData.isEmpty()) optimisticDataMap = new HashMap<K, V>(nodeData);
this.version = node.getVersion();
if (version == null)
{
@@ -69,6 +70,18 @@
}
}
+ protected Set<Fqn> getChildrenAddedSet()
+ {
+ if (childrenAdded == null) childrenAdded = new HashSet<Fqn>();
+ return childrenAdded;
+ }
+
+ protected Set<Fqn> getChildrenRemovedSet()
+ {
+ if (childrenRemoved == null) childrenRemoved = new HashSet<Fqn>();
+ return childrenRemoved;
+ }
+
public boolean isChildrenModified()
{
return childrenModified;
@@ -117,6 +130,7 @@
public V put(K key, V value)
{
modified = true;
+ if (optimisticDataMap == null) optimisticDataMap = new HashMap<K, V>();
return optimisticDataMap.put(key, value);
}
@@ -124,17 +138,19 @@
public V remove(K key)
{
modified = true;
+ if (optimisticDataMap == null) return null;
return optimisticDataMap.remove(key);
}
public V get(K key)
{
- return optimisticDataMap.get(key);
+ return optimisticDataMap == null ? null : optimisticDataMap.get(key);
}
public Set<K> getKeys()
{
+ if (optimisticDataMap == null) return Collections.emptySet();
return optimisticDataMap.keySet();
}
@@ -149,8 +165,8 @@
Set<Object> names = new HashSet<Object>(optimisticChildNodeMap.keySet());
// process deltas
- for (Fqn child : childrenAdded) names.add(child.getLastElement());
- for (Fqn child : childrenRemoved) names.remove(child.getLastElement());
+ if (childrenAdded != null) for (Fqn child : childrenAdded) names.add(child.getLastElement());
+ if (childrenRemoved != null) for (Fqn child : childrenRemoved) names.remove(child.getLastElement());
return names;
}
@@ -170,11 +186,15 @@
private void realPut(Map<K, V> data, boolean eraseData, boolean forceDirtyFlag)
{
if (forceDirtyFlag) modified = true;
- if (eraseData)
+ if (eraseData && optimisticDataMap != null)
{
optimisticDataMap.clear();
}
- if (data != null) optimisticDataMap.putAll(data);
+ if (data != null)
+ {
+ if (optimisticDataMap == null) optimisticDataMap = new HashMap<K, V>();
+ optimisticDataMap.putAll(data);
+ }
}
public Node<K, V> getParent()
@@ -190,18 +210,10 @@
return null;
}
- //see if we already have it
-// NodeSPI<K, V> child = optimisticChildNodeMap.get(child_name);
-
- // if not we need to create it
-// if (child == null)
-// {
NodeFactory<K, V> factory = cache.getConfiguration().getRuntimeConfig().getNodeFactory();
NodeSPI<K, V> child = (NodeSPI<K, V>) factory.createNodeOfType(parent, child_name, parent, null);
-// optimisticChildNodeMap.put(child_name, child);
- childrenAdded.add(child.getFqn());
- childrenRemoved.remove(child.getFqn());
-// }
+ getChildrenAddedSet().add(child.getFqn());
+ if (childrenRemoved != null) childrenRemoved.remove(child.getFqn());
childrenModified = true;
return child;
}
@@ -238,17 +250,27 @@
this.version = version;
}
+ @SuppressWarnings("unchecked")
public List<Set<Fqn>> getMergedChildren()
{
- //return optimisticChildNodeMap;
- List<Set<Fqn>> l = new ArrayList<Set<Fqn>>(2);
- l.add(childrenAdded);
- l.add(childrenRemoved);
+ List l = new ArrayList(2);
+
+ if (childrenAdded != null)
+ l.add(childrenAdded);
+ else
+ l.add(Collections.emptySet());
+
+ if (childrenRemoved != null)
+ l.add(childrenRemoved);
+ else
+ l.add(Collections.emptySet());
+
return l;
}
public Map<K, V> getMergedData()
{
+ if (optimisticDataMap == null) return Collections.emptyMap();
return optimisticDataMap;
}
@@ -266,12 +288,18 @@
{
created = true;
// created != modified!!!
-// modified = true;
}
public Map<K, V> getData()
{
- return Collections.unmodifiableMap(optimisticDataMap);
+ if (optimisticDataMap == null)
+ {
+ return Collections.emptyMap();
+ }
+ else
+ {
+ return Collections.unmodifiableMap(optimisticDataMap);
+ }
}
public String toString()
@@ -322,21 +350,23 @@
public void addChild(WorkspaceNode<K, V> child)
{
-// optimisticChildNodeMap.put(child.getFqn().getLastElement(), child.getNode());
- childrenAdded.add(child.getFqn());
- childrenRemoved.remove(child.getFqn());
+ getChildrenAddedSet().add(child.getFqn());
+ if (childrenRemoved != null) childrenRemoved.remove(child.getFqn());
if (log.isTraceEnabled()) log.trace("Adding child " + child.getFqn());
}
public void clearData()
{
- modified = true;
- optimisticDataMap.clear();
+ if (optimisticDataMap != null)
+ {
+ optimisticDataMap.clear();
+ modified = true;
+ }
}
public int dataSize()
{
- return optimisticDataMap.size();
+ return optimisticDataMap == null ? 0 : optimisticDataMap.size();
}
public boolean hasChild(Object o)
@@ -411,8 +441,8 @@
Fqn childFqn = new Fqn(getFqn(), childName);
/*if (n != null)
{*/
- childrenRemoved.add(childFqn);
- childrenAdded.remove(childFqn);
+ getChildrenRemovedSet().add(childFqn);
+ if (childrenAdded != null) childrenAdded.remove(childFqn);
childrenModified = true;
return node.getChildDirect(childName) != null;
/*}
16 years, 11 months
JBoss Cache SVN: r4978 - core/trunk/src/main/java/org/jboss/cache/marshall.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-04 08:01:55 -0500 (Fri, 04 Jan 2008)
New Revision: 4978
Modified:
core/trunk/src/main/java/org/jboss/cache/marshall/MethodDeclarations.java
Log:
Unnecessary boxing
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/MethodDeclarations.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/MethodDeclarations.java 2008-01-04 12:19:46 UTC (rev 4977)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/MethodDeclarations.java 2008-01-04 13:01:55 UTC (rev 4978)
@@ -430,7 +430,7 @@
*/
public static boolean isCrudMethod(int id)
{
- return crudMethodIds.contains(Integer.valueOf(id));
+ return crudMethodIds.contains(id);
}
public static boolean isTransactionLifecycleMethod(int id)
16 years, 11 months
JBoss Cache SVN: r4977 - in core/trunk/src: main/java/org/jboss/cache/buddyreplication and 10 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-04 07:19:46 -0500 (Fri, 04 Jan 2008)
New Revision: 4977
Modified:
core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
core/trunk/src/main/java/org/jboss/cache/RPCManager.java
core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/ReplicationQueue.java
core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/trunk/src/main/java/org/jboss/cache/invocation/RemoteCacheInvocationDelegate.java
core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java
core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
core/trunk/src/main/java/org/jboss/cache/marshall/MethodCallFactory.java
core/trunk/src/main/java/org/jboss/cache/marshall/MethodDeclarations.java
core/trunk/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java
core/trunk/src/main/java/org/jboss/cache/util/BitEncodedIntegerSet.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java
core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller200Test.java
core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller210Test.java
core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java
core/trunk/src/test/java/org/jboss/cache/marshall/MethodCallFactoryTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/MethodIdPreservationTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/RemoteCallerReturnValuesTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/util/BitEncodedIntegerSetTest.java
Log:
MethodFactory to use MethodIDs instead of Methods
Improved performance of MethodDeclaration lookups
Modified: core/trunk/src/main/java/org/jboss/cache/CacheImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/CacheImpl.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -59,7 +59,6 @@
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import java.io.NotSerializableException;
-import java.lang.reflect.Method;
import java.util.*;
/**
@@ -1172,7 +1171,7 @@
*/
public Node get(Fqn<?> fqn) throws CacheException
{
- MethodCall m = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal, fqn);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal_id, fqn);
return (Node) invokeMethod(m, true);
}
@@ -1203,7 +1202,7 @@
*/
public Map getData(Fqn<?> fqn) throws CacheException
{
- MethodCall m = MethodCallFactory.create(MethodDeclarations.getDataMapMethodLocal, fqn);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.getDataMapMethodLocal_id, fqn);
return (Map) invokeMethod(m, true);
}
@@ -1265,7 +1264,7 @@
protected Object get(Fqn<?> fqn, Object key, boolean sendNodeEvent) throws CacheException
{
- MethodCall m = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, sendNodeEvent);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal_id, fqn, key, sendNodeEvent);
return invokeMethod(m, true);
}
@@ -1389,11 +1388,11 @@
MethodCall m;
if (erase)
{
- m = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal, tx, fqn, data, true, true);
+ m = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal_id, tx, fqn, data, true, true);
}
else
{
- m = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, tx, fqn, data, true);
+ m = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal_id, tx, fqn, data, true);
}
invokeMethod(m, true);
}
@@ -1426,7 +1425,7 @@
public Object put(Fqn<?> fqn, Object key, Object value) throws CacheException
{
GlobalTransaction tx = getCurrentTransaction();
- MethodCall m = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, tx, fqn, key, value, true);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, tx, fqn, key, value, true);
return invokeMethod(m, true);
}
@@ -1465,7 +1464,7 @@
}
else
{
- MethodCall m = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, tx, fqn, true);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal_id, tx, fqn, true);
Object retval = invokeMethod(m, true);
return retval != null && (Boolean) retval;
}
@@ -1497,7 +1496,7 @@
}
else
{
- MethodCall m = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, fqn);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal_id, fqn);
invokeMethod(m, true);
}
}
@@ -1524,7 +1523,7 @@
public Object remove(Fqn<?> fqn, Object key) throws CacheException
{
GlobalTransaction tx = getCurrentTransaction();
- MethodCall m = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal, tx, fqn, key, true);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal_id, tx, fqn, key, true);
return invokeMethod(m, true);
}
@@ -1567,7 +1566,7 @@
*/
public void releaseAllLocks(Fqn fqn)
{
- MethodCall m = MethodCallFactory.create(MethodDeclarations.releaseAllLocksMethodLocal, fqn);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.releaseAllLocksMethodLocal_id, fqn);
try
{
invokeMethod(m, true);
@@ -1593,7 +1592,7 @@
*/
public String print(Fqn fqn)
{
- MethodCall m = MethodCallFactory.create(MethodDeclarations.printMethodLocal, fqn);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.printMethodLocal_id, fqn);
Object retval = null;
try
{
@@ -1622,7 +1621,7 @@
*/
public <E> Set<E> getChildrenNames(Fqn<E> fqn) throws CacheException
{
- MethodCall m = MethodCallFactory.create(MethodDeclarations.getChildrenNamesMethodLocal, fqn);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.getChildrenNamesMethodLocal_id, fqn);
Set<E> retval = null;
retval = (Set<E>) invokeMethod(m, true);
if (retval != null)
@@ -1960,47 +1959,6 @@
return retval;
}
- /**
- * @param members
- * @param method
- * @param args
- * @param synchronous
- * @param exclude_self
- * @param timeout
- * @return
- * @throws Exception
- * @deprecated Note this is due to be moved to an interceptor.
- */
- @Deprecated
- public List callRemoteMethods(List<Address> members, Method method, Object[] args,
- boolean synchronous, boolean exclude_self, long timeout)
- throws Exception
- {
- return callRemoteMethods(members, MethodCallFactory.create(method, args), synchronous, exclude_self, timeout);
- }
-
- /**
- * @param members
- * @param method_name
- * @param types
- * @param args
- * @param synchronous
- * @param exclude_self
- * @param timeout
- * @return
- * @throws Exception
- * @deprecated Note this is due to be moved to an interceptor.
- */
- @Deprecated
- public List callRemoteMethods(Vector<Address> members, String method_name,
- Class[] types, Object[] args,
- boolean synchronous, boolean exclude_self, long timeout)
- throws Exception
- {
- Method method = getClass().getDeclaredMethod(method_name, types);
- return callRemoteMethods(members, method, args, synchronous, exclude_self, timeout);
- }
-
/* -------------------- End Remote method calls ------------------ */
/* --------------------- Callbacks -------------------------- */
@@ -2122,7 +2080,7 @@
if (tx != null && create_undo_ops)
{
// erase and set to previous hashmap contents
- MethodCall undo_op = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal, tx, fqn, new HashMap(rawData), false, true);
+ MethodCall undo_op = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal_id, tx, fqn, new HashMap(rawData), false, true);
transactionTable.addUndoOperation(tx, undo_op);
}
@@ -2195,11 +2153,11 @@
MethodCall undo_op;
if (old_value == null)
{
- undo_op = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal, tx, fqn, key, false);
+ undo_op = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal_id, tx, fqn, key, false);
}
else
{
- undo_op = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, tx, fqn, key, old_value, false);
+ undo_op = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, tx, fqn, key, old_value, false);
}
// 1. put undo-op in TX' undo-operations list (needed to rollback TX)
transactionTable.addUndoOperation(tx, undo_op);
@@ -2344,7 +2302,7 @@
// this modification) and put it into the TX's undo list.
if (tx != null && create_undo_ops && !eviction && found)
{
- undo_op = MethodCallFactory.create(MethodDeclarations.addChildMethodLocal, tx, parent_node.getFqn(), n.getFqn().getLastElement(), n, false);
+ undo_op = MethodCallFactory.create(MethodDeclarations.addChildMethodLocal_id, tx, parent_node.getFqn(), n.getFqn().getLastElement(), n, false);
// 1. put undo-op in TX' undo-operations list (needed to rollback TX)
transactionTable.addUndoOperation(tx, undo_op);
@@ -2415,7 +2373,7 @@
// this modification) and put it into the TX's undo list.
if (tx != null && create_undo_ops && old_value != null)
{
- undo_op = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, tx, fqn, key, old_value, false);
+ undo_op = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, tx, fqn, key, old_value, false);
// 1. put undo-op in TX' undo-operations list (needed to rollback TX)
transactionTable.addUndoOperation(tx, undo_op);
}
@@ -2494,7 +2452,7 @@
{
if (!data.isEmpty())
{
- undo_op = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal,
+ undo_op = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal_id,
tx, fqn, new HashMap(data), false);
}
}
@@ -2730,7 +2688,7 @@
if (gtx != null && undoOps)
{
// 1. put undo-op in TX' undo-operations list (needed to rollback TX)
- transactionTable.addUndoOperation(gtx, MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, gtx, fqn, false));
+ transactionTable.addUndoOperation(gtx, MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal_id, gtx, fqn, false));
}
if (!isRollback) notifier.notifyNodeCreated(fqn, false, ctx);
@@ -3009,7 +2967,7 @@
public void move(Fqn<?> nodeToMove, Fqn<?> newParent)
{
// this needs to be passed up the interceptor chain
- MethodCall m = MethodCallFactory.create(MethodDeclarations.moveMethodLocal, nodeToMove, newParent);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.moveMethodLocal_id, nodeToMove, newParent);
invokeMethod(m, true);
}
@@ -3060,7 +3018,7 @@
// now register an undo op
if (ctx.getTransaction() != null)
{
- MethodCall undo = MethodCallFactory.create(MethodDeclarations.moveMethodLocal, new Fqn(newParentFqn, nodeToMoveFqn.getLastElement()), oldParent.getFqn());
+ MethodCall undo = MethodCallFactory.create(MethodDeclarations.moveMethodLocal_id, new Fqn(newParentFqn, nodeToMoveFqn.getLastElement()), oldParent.getFqn());
transactionTable.addUndoOperation(ctx.getGlobalTransaction(), undo);
}
}
@@ -3811,7 +3769,7 @@
{
spi.getInvocationContext().getOptionOverrides().setFailSilently(true);
GlobalTransaction tx = getCurrentTransaction();
- MethodCall m = MethodCallFactory.create(MethodDeclarations.putForExternalReadMethodLocal, tx, fqn, key, value);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.putForExternalReadMethodLocal_id, tx, fqn, key, value);
invokeMethod(m, true);
}
else
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManager.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManager.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -4,7 +4,6 @@
import org.jgroups.Address;
import org.jgroups.blocks.RspFilter;
-import java.lang.reflect.Method;
import java.util.List;
public interface RPCManager
@@ -23,8 +22,6 @@
public List callRemoteMethods(List<Address> recipients, MethodCall methodCall, boolean synchronous, boolean excludeSelf, int timeout) throws Exception;
- public List callRemoteMethods(List<Address> recipients, Method method, Object[] arguments, boolean synchronous, boolean excludeSelf, long timeout) throws Exception;
-
/**
* @return Returns the replication queue (if one is used), null otherwise.
*/
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -11,7 +11,6 @@
import org.jgroups.Address;
import org.jgroups.blocks.RspFilter;
-import java.lang.reflect.Method;
import java.util.List;
/**
@@ -71,12 +70,6 @@
return c.callRemoteMethods(recipients, methodCall, synchronous, excludeSelf, timeout);
}
- @SuppressWarnings("deprecation")
- public List callRemoteMethods(List<Address> recipients, Method method, Object[] arguments, boolean synchronous, boolean excludeSelf, long timeout) throws Exception
- {
- return c.callRemoteMethods(recipients, method, arguments, synchronous, excludeSelf, timeout);
- }
-
/**
* @return Returns the replication queue (if one is used), null otherwise.
*/
Modified: core/trunk/src/main/java/org/jboss/cache/ReplicationQueue.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/ReplicationQueue.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/ReplicationQueue.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -10,6 +10,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.marshall.MethodCall;
+import org.jboss.cache.marshall.MethodCallFactory;
import org.jboss.cache.marshall.MethodDeclarations;
import java.util.ArrayList;
@@ -119,8 +120,8 @@
{
timer = new Timer(true);
timer.schedule(task,
- 500, // delay before initial flush
- interval); // interval between flushes
+ 500, // delay before initial flush
+ interval); // interval between flushes
}
}
}
@@ -177,7 +178,7 @@
try
{
// send to all live nodes in the cluster
- cache.getRPCManager().callRemoteMethods(null, MethodDeclarations.replicateAllMethod, new Object[]{l}, false, true, 5000);
+ cache.getRPCManager().callRemoteMethods(null, MethodCallFactory.create(MethodDeclarations.replicateAllMethod_id, l), false, true, 5000);
}
catch (Throwable t)
{
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -285,7 +285,7 @@
children.put(child_name, child);
if (gtx != null)
{
- MethodCall undo_op = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal,
+ MethodCall undo_op = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal_id,
gtx, child_fqn, false);
cacheImpl.addUndoOperation(gtx, undo_op);
// add the node name to the list maintained for the current tx
Modified: core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -683,7 +683,7 @@
{
if (call != null && call.getArgs() != null && call.getMethodId() != MethodDeclarations.commitMethod_id)
{
- MethodCall call2 = MethodCallFactory.create(call.getMethod(), call.getArgs().clone());
+ MethodCall call2 = MethodCallFactory.create(call.getMethodId(), call.getArgs().clone());
handleArgs(call2.getArgs(), transformForCurrentCall);
return call2;
}
@@ -703,7 +703,7 @@
}
buddyGroup.removeBuddies(buddies);
// now broadcast a message to the removed buddies.
- MethodCall membershipCall = MethodCallFactory.create(MethodDeclarations.remoteRemoveFromBuddyGroupMethod, buddyGroup.getGroupName());
+ MethodCall membershipCall = MethodCallFactory.create(MethodDeclarations.remoteRemoveFromBuddyGroupMethod_id, buddyGroup.getGroupName());
int attemptsLeft = UNINIT_BUDDIES_RETRIES;
int currentAttempt = 0;
@@ -804,7 +804,7 @@
}
// now broadcast a message to the newly assigned buddies.
- MethodCall membershipCall = MethodCallFactory.create(MethodDeclarations.remoteAssignToBuddyGroupMethod, buddyGroup, stateMap);
+ MethodCall membershipCall = MethodCallFactory.create(MethodDeclarations.remoteAssignToBuddyGroupMethod_id, buddyGroup, stateMap);
int attemptsLeft = UNINIT_BUDDIES_RETRIES;
int currentAttempt = 0;
@@ -967,7 +967,7 @@
log.debug("Instance " + buddyGroup.getDataOwner() + " broadcasting membership in buddy pool " + config.getBuddyPoolName() + " to recipients " + recipients);
}
- MethodCall membershipCall = MethodCallFactory.create(MethodDeclarations.remoteAnnounceBuddyPoolNameMethod, buddyGroup.getDataOwner(), config.getBuddyPoolName());
+ MethodCall membershipCall = MethodCallFactory.create(MethodDeclarations.remoteAnnounceBuddyPoolNameMethod_id, buddyGroup.getDataOwner(), config.getBuddyPoolName());
try
{
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -114,7 +114,7 @@
long syncReplTimeout = o.getSyncReplTimeout();
if (syncReplTimeout < 0) syncReplTimeout = configuration.getSyncReplTimeout();
- MethodCall toCall = wrapMethodCallInReplicateMethod ? toCall = MethodCallFactory.create(MethodDeclarations.replicateMethod, call) : call;
+ MethodCall toCall = wrapMethodCallInReplicateMethod ? toCall = MethodCallFactory.create(MethodDeclarations.replicateMethod_id, call) : call;
List rsps = rpcManager.callRemoteMethods(callRecipients,
toCall,
@@ -130,7 +130,7 @@
protected void putCallOnAsyncReplicationQueue(MethodCall call)
{
if (log.isDebugEnabled()) log.debug("Putting call " + call + " on the replication queue.");
- rpcManager.getReplicationQueue().add(MethodCallFactory.create(MethodDeclarations.replicateMethod, call));
+ rpcManager.getReplicationQueue().add(MethodCallFactory.create(MethodDeclarations.replicateMethod_id, call));
}
//todo info expt for this is InvocationContext, move method there
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -460,7 +460,7 @@
if (configuration.isNodeLockingOptimistic()) return;
- MethodCall m = MethodCallFactory.create(MethodDeclarations.lockMethodLocal,
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.lockMethodLocal_id,
fqn, lock_type, recursive);
// hacky
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -242,11 +242,11 @@
mods.add(cleanup);
if (configuration.isNodeLockingOptimistic())
{
- prepare = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, gtx, mods, null, cache.getLocalAddress(), false);
+ prepare = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, gtx, mods, null, cache.getLocalAddress(), false);
}
else
{
- prepare = MethodCallFactory.create(MethodDeclarations.prepareMethod, gtx, mods, cache.getLocalAddress(), syncCommunications);
+ prepare = MethodCallFactory.create(MethodDeclarations.prepareMethod_id, gtx, mods, cache.getLocalAddress(), syncCommunications);
}
replicateCall(ctx, getMembersOutsideBuddyGroup(), prepare, syncCommunications, ctx.getOptionOverrides());
@@ -262,7 +262,7 @@
if (transactionMods.containsKey(gtx))
{
if (trace) log.trace("Broadcasting commit for gtx " + gtx);
- replicateCall(ctx, getMembersOutsideBuddyGroup(), MethodCallFactory.create(MethodDeclarations.commitMethod, gtx), syncCommunications, ctx.getOptionOverrides());
+ replicateCall(ctx, getMembersOutsideBuddyGroup(), MethodCallFactory.create(MethodDeclarations.commitMethod_id, gtx), syncCommunications, ctx.getOptionOverrides());
}
else
{
@@ -300,7 +300,7 @@
private void cleanBackupData(BackupData backup, GlobalTransaction gtx, InvocationContext ctx) throws Throwable
{
- MethodCall cleanup = MethodCallFactory.create(MethodDeclarations.dataGravitationCleanupMethod, backup.primaryFqn, backup.backupFqn);
+ MethodCall cleanup = MethodCallFactory.create(MethodDeclarations.dataGravitationCleanupMethod_id, backup.primaryFqn, backup.backupFqn);
if (trace) log.trace("Performing cleanup on [" + backup.primaryFqn + "]");
@@ -332,7 +332,7 @@
}
List<Address> mbrs = cache.getMembers();
Boolean searchSubtrees = (buddyManager.isDataGravitationSearchBackupTrees() ? Boolean.TRUE : Boolean.FALSE);
- MethodCall dGrav = MethodCallFactory.create(MethodDeclarations.dataGravitationMethod, fqn, searchSubtrees);
+ MethodCall dGrav = MethodCallFactory.create(MethodDeclarations.dataGravitationMethod_id, fqn, searchSubtrees);
// doing a GET_ALL is crappy but necessary since JGroups' GET_FIRST could return null results from nodes that do
// not have either the primary OR backup, and stop polling other valid nodes.
List resps = cache.getRPCManager().callRemoteMethods(mbrs, dGrav, GroupRequest.GET_ALL, true, buddyManager.getBuddyCommunicationTimeout(), new ResponseValidityFilter(mbrs, cache.getLocalAddress()));
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -333,7 +333,7 @@
MethodCallFactory.create(MethodDeclarations.evictVersionedNodeMethodLocal, fqn, workspace.getNode(fqn).getVersion()) :
MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, fqn);
*/
- MethodCall call = MethodCallFactory.create(MethodDeclarations.invalidateMethodLocal, fqn, getNodeVersion(workspace, fqn));
+ MethodCall call = MethodCallFactory.create(MethodDeclarations.invalidateMethodLocal_id, fqn, getNodeVersion(workspace, fqn));
if (log.isDebugEnabled()) log.debug("Cache [" + cache.getLocalAddress() + "] replicating " + call);
// voila, invalidated!
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -212,7 +212,7 @@
try
{
broadcastTxs.remove(gtx);
- MethodCall commit_method = MethodCallFactory.create(MethodDeclarations.commitMethod, gtx);
+ MethodCall commit_method = MethodCallFactory.create(MethodDeclarations.commitMethod_id, gtx);
if (log.isDebugEnabled())
log.debug("running remote commit for " + gtx + " and coord=" + cache.getLocalAddress());
@@ -237,7 +237,7 @@
try
{
broadcastTxs.remove(gtx);
- MethodCall rollback_method = MethodCallFactory.create(MethodDeclarations.rollbackMethod, gtx);
+ MethodCall rollback_method = MethodCallFactory.create(MethodDeclarations.rollbackMethod_id, gtx);
if (log.isDebugEnabled())
log.debug("running remote rollback for " + gtx + " and coord=" + cache.getLocalAddress());
@@ -254,7 +254,7 @@
private MethodCall mapDataVersionedMethodCalls(MethodCall m, TransactionWorkspace w)
{
Object[] origArgs = m.getArgs();
- return MethodCallFactory.create(m.getMethod(), origArgs[0], translate((List<MethodCall>) origArgs[1], w), origArgs[2], origArgs[3], origArgs[4]);
+ return MethodCallFactory.create(m.getMethodId(), origArgs[0], translate((List<MethodCall>) origArgs[1], w), origArgs[2], origArgs[3], origArgs[4]);
}
/**
@@ -287,7 +287,7 @@
newArgs[origArgs.length] = versionToBroadcast;
// now create a new method call which contains this data version
- MethodCall newCall = MethodCallFactory.create(MethodDeclarations.getVersionedMethod(origCall.getMethodId()), newArgs);
+ MethodCall newCall = MethodCallFactory.create(MethodDeclarations.getVersionedMethodId(origCall.getMethodId()), newArgs);
// and add it to the new list.
newList.add(newCall);
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -681,7 +681,7 @@
Object[] args = new Object[origArgs.length - 1];
System.arraycopy(origArgs, 0, args, 0, args.length);
- ctx.setMethodCall(MethodCallFactory.create(MethodDeclarations.getUnversionedMethod(modification.getMethodId()), args));
+ ctx.setMethodCall(MethodCallFactory.create(MethodDeclarations.getUnversionedMethodId(modification.getMethodId()), args));
if (o != null) ctx.setOptionOverrides(o);
}
else
@@ -873,19 +873,19 @@
// running a 1-phase commit.
if (configuration.isNodeLockingOptimistic())
{
- commitMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod,
+ commitMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id,
gtx, modifications, null, cache.getLocalAddress(), true);
}
else
{
- commitMethod = MethodCallFactory.create(MethodDeclarations.prepareMethod,
+ commitMethod = MethodCallFactory.create(MethodDeclarations.prepareMethod_id,
gtx, modifications, cache.getLocalAddress(),
true);
}
}
else
{
- commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod, gtx);
+ commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod_id, gtx);
}
if (trace)
@@ -942,7 +942,7 @@
ctx.setTxHasMods(modifications != null && modifications.size() > 0);
// JBCACHE-457
// MethodCall rollbackMethod = MethodCall(CacheImpl.rollbackMethod, new Object[]{gtx, hasMods ? true : false});
- MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod, gtx);
+ MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod_id, gtx);
if (trace)
{
log.trace(" running rollback for " + gtx);
@@ -982,11 +982,11 @@
// running a 2-phase commit.
if (configuration.isNodeLockingOptimistic())
{
- prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, gtx, modifications, null, cache.getLocalAddress(), false);
+ prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, gtx, modifications, null, cache.getLocalAddress(), false);
}
else if (configuration.getCacheMode() != Configuration.CacheMode.REPL_ASYNC)
{
- prepareMethod = MethodCallFactory.create(MethodDeclarations.prepareMethod,
+ prepareMethod = MethodCallFactory.create(MethodDeclarations.prepareMethod_id,
gtx, modifications, cache.getLocalAddress(),
false);// don't commit or rollback - wait for call
}
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -322,7 +322,7 @@
public void move(Fqn<?> nodeToMove, Fqn<?> newParent) throws NodeNotExistsException
{
- MethodCall m = MethodCallFactory.create(MethodDeclarations.moveMethodLocal, nodeToMove, newParent);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.moveMethodLocal_id, nodeToMove, newParent);
invoke(m);
}
@@ -392,14 +392,14 @@
}
else
{
- MethodCall m = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, fqn);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal_id, fqn);
invoke(m);
}
}
public V get(Fqn<?> fqn, K key)
{
- MethodCall m = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, true);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal_id, fqn, key, true);
return (V) invoke(m);
}
@@ -432,7 +432,7 @@
}
else
{
- MethodCall m = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, tx, fqn, true);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal_id, tx, fqn, true);
Object retval = invoke(m);
return retval != null && (Boolean) retval;
}
@@ -446,7 +446,7 @@
public Node getNode(Fqn<?> fqn)
{
- MethodCall m = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal, fqn);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal_id, fqn);
return (Node) invoke(m);
}
@@ -458,7 +458,7 @@
public V remove(Fqn<?> fqn, K key) throws CacheException
{
GlobalTransaction tx = cache.getCurrentTransaction();
- MethodCall m = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal, tx, fqn, key, true);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal_id, tx, fqn, key, true);
return (V) invoke(m);
}
@@ -470,7 +470,7 @@
public void put(Fqn<?> fqn, Map<K, V> data)
{
GlobalTransaction tx = cache.getCurrentTransaction();
- MethodCall m = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, tx, fqn, data, true);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal_id, tx, fqn, data, true);
invoke(m);
}
@@ -487,7 +487,7 @@
getInvocationContext().getOptionOverrides().setFailSilently(true);
getInvocationContext().getOptionOverrides().setForceAsynchronous(true);
//GlobalTransaction tx = cache.getCurrentTransaction();
- MethodCall m = MethodCallFactory.create(MethodDeclarations.putForExternalReadMethodLocal, null, fqn, key, value);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.putForExternalReadMethodLocal_id, null, fqn, key, value);
invoke(m);
}
else
@@ -500,7 +500,7 @@
public V put(Fqn<?> fqn, K key, V value)
{
GlobalTransaction tx = cache.getCurrentTransaction();
- MethodCall m = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, tx, fqn, key, value, true);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, tx, fqn, key, value, true);
return (V) invoke(m);
}
@@ -533,7 +533,7 @@
*/
public Map<K, V> getData(Fqn<?> fqn)
{
- MethodCall m = MethodCallFactory.create(MethodDeclarations.getDataMapMethodLocal, fqn);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.getDataMapMethodLocal_id, fqn);
return (Map<K, V>) invoke(m);
}
@@ -558,7 +558,7 @@
*/
public Set<K> getKeys(Fqn<?> fqn)
{
- MethodCall m = MethodCallFactory.create(MethodDeclarations.getKeysMethodLocal, fqn);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.getKeysMethodLocal_id, fqn);
return (Set<K>) invoke(m);
}
@@ -576,7 +576,7 @@
public void clearData(Fqn fqn)
{
GlobalTransaction tx = getCurrentTransaction();
- MethodCall m = MethodCallFactory.create(MethodDeclarations.removeDataMethodLocal, tx, fqn, true);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.removeDataMethodLocal_id, tx, fqn, true);
invoke(m);
}
@@ -589,7 +589,7 @@
*/
public <E> Set<E> getChildrenNames(Fqn<E> fqn)
{
- MethodCall m = MethodCallFactory.create(MethodDeclarations.getChildrenNamesMethodLocal, fqn);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.getChildrenNamesMethodLocal_id, fqn);
Set<E> retval = null;
retval = (Set<E>) invoke(m);
if (retval != null)
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/RemoteCacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/RemoteCacheInvocationDelegate.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/RemoteCacheInvocationDelegate.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -132,13 +132,13 @@
public void block()
{
- MethodCall m = MethodCallFactory.create(MethodDeclarations.blockChannelLocal);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.blockChannelMethodLocal_id);
invoke(m, true);
}
public void unblock()
{
- MethodCall m = MethodCallFactory.create(MethodDeclarations.unblockChannelLocal);
+ MethodCall m = MethodCallFactory.create(MethodDeclarations.unblockChannelMethodLocal_id);
invoke(m, true);
}
Modified: core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -86,7 +86,7 @@
lock.acquireLock(fqn, true);
try
{
- MethodCall call = MethodCallFactory.create(MethodDeclarations.getChildrenNamesMethodLocal, fqn);
+ MethodCall call = MethodCallFactory.create(MethodDeclarations.getChildrenNamesMethodLocal_id, fqn);
Object resp = callRemote(call);
return (Set) resp;
}
@@ -100,7 +100,7 @@
{
if (log.isTraceEnabled()) log.trace("cache=" + cache.getLocalAddress() + "; calling with " + call);
List<Address> mbrs = cache.getMembers();
- MethodCall clusteredGet = MethodCallFactory.create(MethodDeclarations.clusteredGetMethod, call, false);
+ MethodCall clusteredGet = MethodCallFactory.create(MethodDeclarations.clusteredGetMethod_id, call, false);
List resps = null;
// JBCACHE-1186
resps = cache.getRPCManager().callRemoteMethods(mbrs, clusteredGet, GroupRequest.GET_ALL, true, config.getTimeout(), new ResponseValidityFilter(mbrs, cache.getLocalAddress()));
@@ -159,7 +159,7 @@
lock.acquireLock(name, true);
try
{
- MethodCall call = MethodCallFactory.create(MethodDeclarations.getDataMapMethodLocal, name);
+ MethodCall call = MethodCallFactory.create(MethodDeclarations.getDataMapMethodLocal_id, name);
Object resp = callRemote(call);
return (Map) resp;
}
@@ -177,7 +177,7 @@
lock.acquireLock(name, false);
try
{
- MethodCall call = MethodCallFactory.create(MethodDeclarations.existsMethod, name);
+ MethodCall call = MethodCallFactory.create(MethodDeclarations.existsMethod_id, name);
Object resp = callRemote(call);
return resp != null && (Boolean) resp;
@@ -198,7 +198,7 @@
NodeSPI n = cache.peek(name, false);
if (n == null)
{
- MethodCall call = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, name, key, true);
+ MethodCall call = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal_id, name, key, true);
return callRemote(call);
}
else
@@ -242,7 +242,7 @@
NodeSPI n = cache.peek(name, true);
if (n == null)
{
- MethodCall call = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, name, key, true);
+ MethodCall call = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal_id, name, key, true);
return callRemote(call);
}
else
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -35,7 +35,8 @@
protected boolean useRegionBasedMarshalling;
protected RegionManager regionManager;
protected boolean defaultInactive;
- protected Log log = LogFactory.getLog(AbstractMarshaller.class);
+ protected Log log;
+ protected boolean trace;
/**
* Map<GlobalTransaction, Fqn> for prepared tx that have not committed
@@ -57,6 +58,12 @@
this.defaultInactive = configuration.isInactiveOnStartup();
}
+ protected void initLogger()
+ {
+ log = LogFactory.getLog(getClass());
+ trace = log.isTraceEnabled();
+ }
+
// implement the basic contract set in RPcDispatcher.AbstractMarshaller
public byte[] objectToByteBuffer(Object obj) throws Exception
{
@@ -179,7 +186,7 @@
}
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("extract(): received " + methodCall + "extracted fqn: " + fqn);
}
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -6,7 +6,6 @@
*/
package org.jboss.cache.marshall;
-import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.Region;
import static org.jboss.cache.Region.Status;
@@ -64,7 +63,6 @@
public CacheMarshaller200()
{
- log = LogFactory.getLog(CacheMarshaller200.class);
}
/**
@@ -99,7 +97,7 @@
// a Fqn region.
region = regionForCall.get();
regionForCall.remove();
- if (log.isTraceEnabled())
+ if (trace)
log.trace("Suspect this is a return value. Extract region from ThreadLocal as " + region);
// otherwise, we need to marshall the retval.
@@ -111,13 +109,13 @@
MethodCall call = (MethodCall) o;
region = extractFqnRegion(call);
}
- if (log.isTraceEnabled()) log.trace("Region based call. Using region " + region);
+ if (trace) log.trace("Region based call. Using region " + region);
objectToObjectStream(o, out, region);
}
else
{
// not region based!
- if (log.isTraceEnabled()) log.trace("Marshalling object " + o);
+ if (trace) log.trace("Marshalling object " + o);
Map<Object, Integer> refMap = new HashMap<Object, Integer>();
marshallObject(o, out, refMap);
}
@@ -133,14 +131,14 @@
{
Map<Integer, Object> refMap = new HashMap<Integer, Object>();
Object retValue = unmarshallObject(in, refMap);
- if (log.isTraceEnabled()) log.trace("Unmarshalled object " + retValue);
+ if (trace) log.trace("Unmarshalled object " + retValue);
return retValue;
}
}
public void objectToObjectStream(Object o, ObjectOutputStream out, Fqn region) throws Exception
{
- if (log.isTraceEnabled()) log.trace("Marshalling object " + o);
+ if (trace) log.trace("Marshalling object " + o);
Map<Object, Integer> refMap = new HashMap<Object, Integer>();
if (useRegionBasedMarshalling) // got to check again in case this meth is called directly
{
@@ -165,7 +163,7 @@
regionFqn = (Fqn) o;
}
- if (log.isTraceEnabled()) log.trace("Unmarshalled regionFqn " + regionFqn + " from stream");
+ if (trace) log.trace("Unmarshalled regionFqn " + regionFqn + " from stream");
Region region = null;
Object retValue;
@@ -187,7 +185,7 @@
// only set this if this is an incoming method call and not a return value.
if (!isReturnValue(retValue)) regionForCall.set(regionFqn);
}
- if (log.isTraceEnabled()) log.trace("Unmarshalled object " + retValue);
+ if (trace) log.trace("Unmarshalled object " + retValue);
return retValue;
}
@@ -389,7 +387,7 @@
}
else if (o instanceof Serializable)
{
- if (log.isTraceEnabled())
+ if (trace)
{
log.trace("Warning: using object serialization for " + o.getClass());
}
@@ -638,7 +636,7 @@
args[i] = unmarshallObject(in, refMap);
}
}
- return MethodCallFactory.create(MethodDeclarations.lookupMethod(methodId), args);
+ return MethodCallFactory.create(methodId, args);
}
private GlobalTransaction unmarshallGlobalTransaction(ObjectInputStream in, Map<Integer, Object> refMap) throws Exception
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/MethodCallFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/MethodCallFactory.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/MethodCallFactory.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -20,14 +20,13 @@
/**
* Creates and initialised an instance of MethodCall.
*
- * @param method Method instance of the MethodCall
- * @param target The InvocationTarget instance to invoke the call on
+ * @param methodId Method ID of the MethodCall
* @param arguments list of parameters
* @return a new instance of MethodCall with the method id initialised
*/
- public static MethodCall create(Method method, Object... arguments)
+ public static MethodCall create(int methodId, Object... arguments)
{
- return new MethodCall(method, MethodDeclarations.lookupMethodId(method), arguments);
+ return new MethodCall(MethodDeclarations.lookupMethod(methodId), methodId, arguments);
}
/**
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/MethodDeclarations.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/MethodDeclarations.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/MethodDeclarations.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -18,14 +18,13 @@
import org.jboss.cache.lock.NodeLock;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.cache.util.BitEncodedIntegerSet;
import org.jgroups.Address;
import java.lang.reflect.Method;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
/**
* Class containing Method and Method id definitions as well methods
@@ -38,10 +37,16 @@
{
private static Log log = LogFactory.getLog(MethodDeclarations.class);
- static final Set<Integer> methodsThatNeedToReturnValuesToRemoteCallers = new HashSet<Integer>();
+ static final BitEncodedIntegerSet crudMethodIds = new BitEncodedIntegerSet();
+ static final BitEncodedIntegerSet transactionLifecycleMethodIds = new BitEncodedIntegerSet();
+ static final BitEncodedIntegerSet buddyGroupOrganisationMethodIds = new BitEncodedIntegerSet();
+ static final BitEncodedIntegerSet blockUnblockMethodIds = new BitEncodedIntegerSet();
+ static final BitEncodedIntegerSet putMethodIds = new BitEncodedIntegerSet();
+ static final BitEncodedIntegerSet methodsThatNeedToReturnValuesToRemoteCallers = new BitEncodedIntegerSet();
- // maintain a list of method IDs that correspond to Methods in CacheImpl
- static final Map<Integer, Method> methods = new HashMap<Integer, Method>();
+ // maintain a list of method IDs that correspond to Methods
+ // Mapping ids to Methods are done via an array lookup where the subscript is a method id.
+ static final Method[] methods = new Method[48]; // the largest method id is 47 so this array needs to accommodate a subscript of 47.
// and for reverse lookup
static final Map<Method, Integer> methodIds = new HashMap<Method, Integer>();
@@ -108,9 +113,9 @@
public static final Method moveMethodLocal;
- public static final Method blockChannelLocal;
+ public static final Method blockChannelMethodLocal;
- public static final Method unblockChannelLocal;
+ public static final Method unblockChannelMethodLocal;
public static final Method putForExternalReadMethodLocal;
@@ -278,8 +283,8 @@
moveMethodLocal = CacheImpl.class.getDeclaredMethod("_move", Fqn.class, Fqn.class);
// ------------ Channel BLOCK event
- blockChannelLocal = CacheImpl.class.getDeclaredMethod("_block");
- unblockChannelLocal = CacheImpl.class.getDeclaredMethod("_unblock");
+ blockChannelMethodLocal = CacheImpl.class.getDeclaredMethod("_block");
+ unblockChannelMethodLocal = CacheImpl.class.getDeclaredMethod("_unblock");
// ------------ version-aware methods - see JBCACHE-843
putDataVersionedMethodLocal = CacheImpl.class.getDeclaredMethod("_put", GlobalTransaction.class, Fqn.class, Map.class, boolean.class, DataVersion.class);
@@ -298,59 +303,92 @@
throw new ExceptionInInitializerError(e);
}
- methods.put(putDataMethodLocal_id, putDataMethodLocal);
- methods.put(putDataEraseMethodLocal_id, putDataEraseMethodLocal);
- methods.put(putKeyValMethodLocal_id, putKeyValMethodLocal);
- methods.put(removeNodeMethodLocal_id, removeNodeMethodLocal);
- methods.put(removeKeyMethodLocal_id, removeKeyMethodLocal);
- methods.put(removeDataMethodLocal_id, removeDataMethodLocal);
- methods.put(evictNodeMethodLocal_id, evictNodeMethodLocal);
- methods.put(evictVersionedNodeMethodLocal_id, evictVersionedNodeMethodLocal);
- methods.put(prepareMethod_id, prepareMethod);
- methods.put(commitMethod_id, commitMethod);
- methods.put(rollbackMethod_id, rollbackMethod);
- methods.put(replicateMethod_id, replicateMethod);
- methods.put(replicateAllMethod_id, replicateAllMethod);
- methods.put(addChildMethodLocal_id, addChildMethodLocal);
- methods.put(existsMethod_id, existsMethod);
- methods.put(releaseAllLocksMethodLocal_id, releaseAllLocksMethodLocal);
- methods.put(optimisticPrepareMethod_id, optimisticPrepareMethod);
- methods.put(clusteredGetMethod_id, clusteredGetMethod);
- methods.put(getChildrenNamesMethodLocal_id, getChildrenNamesMethodLocal);
- methods.put(getDataMapMethodLocal_id, getDataMapMethodLocal);
- methods.put(getKeysMethodLocal_id, getKeysMethodLocal);
- methods.put(getKeyValueMethodLocal_id, getKeyValueMethodLocal);
- methods.put(remoteAnnounceBuddyPoolNameMethod_id, remoteAnnounceBuddyPoolNameMethod);
- methods.put(remoteAssignToBuddyGroupMethod_id, remoteAssignToBuddyGroupMethod);
- methods.put(remoteRemoveFromBuddyGroupMethod_id, remoteRemoveFromBuddyGroupMethod);
+ methods[putDataMethodLocal_id] = putDataMethodLocal;
+ methods[putDataEraseMethodLocal_id] = putDataEraseMethodLocal;
+ methods[putKeyValMethodLocal_id] = putKeyValMethodLocal;
+ methods[removeNodeMethodLocal_id] = removeNodeMethodLocal;
+ methods[removeKeyMethodLocal_id] = removeKeyMethodLocal;
+ methods[removeDataMethodLocal_id] = removeDataMethodLocal;
+ methods[evictNodeMethodLocal_id] = evictNodeMethodLocal;
+ methods[evictVersionedNodeMethodLocal_id] = evictVersionedNodeMethodLocal;
+ methods[prepareMethod_id] = prepareMethod;
+ methods[commitMethod_id] = commitMethod;
+ methods[rollbackMethod_id] = rollbackMethod;
+ methods[replicateMethod_id] = replicateMethod;
+ methods[replicateAllMethod_id] = replicateAllMethod;
+ methods[addChildMethodLocal_id] = addChildMethodLocal;
+ methods[existsMethod_id] = existsMethod;
+ methods[releaseAllLocksMethodLocal_id] = releaseAllLocksMethodLocal;
+ methods[optimisticPrepareMethod_id] = optimisticPrepareMethod;
+ methods[clusteredGetMethod_id] = clusteredGetMethod;
+ methods[getChildrenNamesMethodLocal_id] = getChildrenNamesMethodLocal;
+ methods[getDataMapMethodLocal_id] = getDataMapMethodLocal;
+ methods[getKeysMethodLocal_id] = getKeysMethodLocal;
+ methods[getKeyValueMethodLocal_id] = getKeyValueMethodLocal;
+ methods[remoteAnnounceBuddyPoolNameMethod_id] = remoteAnnounceBuddyPoolNameMethod;
+ methods[remoteAssignToBuddyGroupMethod_id] = remoteAssignToBuddyGroupMethod;
+ methods[remoteRemoveFromBuddyGroupMethod_id] = remoteRemoveFromBuddyGroupMethod;
/* Mappings added as they did not exist before refactoring */
- methods.put(getNodeMethodLocal_id, getNodeMethodLocal);
- methods.put(printMethodLocal_id, printMethodLocal);
- methods.put(lockMethodLocal_id, lockMethodLocal);
+ methods[getNodeMethodLocal_id] = getNodeMethodLocal;
+ methods[printMethodLocal_id] = printMethodLocal;
+ methods[lockMethodLocal_id] = lockMethodLocal;
- methods.put(dataGravitationCleanupMethod_id, dataGravitationCleanupMethod);
- methods.put(dataGravitationMethod_id, dataGravitationMethod);
+ methods[dataGravitationCleanupMethod_id] = dataGravitationCleanupMethod;
+ methods[dataGravitationMethod_id] = dataGravitationMethod;
- methods.put(moveMethodLocal_id, moveMethodLocal);
- methods.put(blockChannelMethodLocal_id, blockChannelLocal);
- methods.put(unblockChannelMethodLocal_id, unblockChannelLocal);
+ methods[moveMethodLocal_id] = moveMethodLocal;
+ methods[blockChannelMethodLocal_id] = blockChannelMethodLocal;
+ methods[unblockChannelMethodLocal_id] = unblockChannelMethodLocal;
- methods.put(putDataVersionedMethodLocal_id, putDataVersionedMethodLocal);
- methods.put(putDataEraseVersionedMethodLocal_id, putDataEraseVersionedMethodLocal);
- methods.put(putKeyValVersionedMethodLocal_id, putKeyValVersionedMethodLocal);
- methods.put(removeDataVersionedMethodLocal_id, removeDataVersionedMethodLocal);
- methods.put(removeKeyVersionedMethodLocal_id, removeKeyVersionedMethodLocal);
- methods.put(removeNodeVersionedMethodLocal_id, removeNodeVersionedMethodLocal);
+ methods[putDataVersionedMethodLocal_id] = putDataVersionedMethodLocal;
+ methods[putDataEraseVersionedMethodLocal_id] = putDataEraseVersionedMethodLocal;
+ methods[putKeyValVersionedMethodLocal_id] = putKeyValVersionedMethodLocal;
+ methods[removeDataVersionedMethodLocal_id] = removeDataVersionedMethodLocal;
+ methods[removeKeyVersionedMethodLocal_id] = removeKeyVersionedMethodLocal;
+ methods[removeNodeVersionedMethodLocal_id] = removeNodeVersionedMethodLocal;
- methods.put(putForExternalReadVersionedMethodLocal_id, putForExternalReadVersionedMethodLocal);
- methods.put(putForExternalReadMethodLocal_id, putForExternalReadMethodLocal);
+ methods[putForExternalReadVersionedMethodLocal_id] = putForExternalReadVersionedMethodLocal;
+ methods[putForExternalReadMethodLocal_id] = putForExternalReadMethodLocal;
- methods.put(invalidateMethodLocal_id, invalidateMethodLocal);
+ methods[invalidateMethodLocal_id] = invalidateMethodLocal;
- for (Integer id : methods.keySet())
+ for (int id = 0; id < methods.length; id++)
{
- methodIds.put(methods.get(id), id);
+ if (methods[id] != null) methodIds.put(methods[id], id);
}
+
+ putMethodIds.add(putDataMethodLocal_id);
+ putMethodIds.add(putDataEraseMethodLocal_id);
+ putMethodIds.add(putKeyValMethodLocal_id);
+ putMethodIds.add(putDataEraseVersionedMethodLocal_id);
+ putMethodIds.add(putDataVersionedMethodLocal_id);
+ putMethodIds.add(putKeyValVersionedMethodLocal_id);
+ putMethodIds.add(putForExternalReadMethodLocal_id);
+ putMethodIds.add(putForExternalReadVersionedMethodLocal_id);
+
+ crudMethodIds.addAll(putMethodIds);
+ crudMethodIds.add(removeNodeMethodLocal_id);
+ crudMethodIds.add(removeKeyMethodLocal_id);
+ crudMethodIds.add(removeDataMethodLocal_id);
+ crudMethodIds.add(dataGravitationCleanupMethod_id);
+ crudMethodIds.add(moveMethodLocal_id);
+ crudMethodIds.add(removeNodeVersionedMethodLocal_id);
+ crudMethodIds.add(removeKeyVersionedMethodLocal_id);
+ crudMethodIds.add(removeDataVersionedMethodLocal_id);
+
+
+ transactionLifecycleMethodIds.add(commitMethod_id);
+ transactionLifecycleMethodIds.add(rollbackMethod_id);
+ transactionLifecycleMethodIds.add(prepareMethod_id);
+ transactionLifecycleMethodIds.add(optimisticPrepareMethod_id);
+
+ buddyGroupOrganisationMethodIds.add(remoteAnnounceBuddyPoolNameMethod_id);
+ buddyGroupOrganisationMethodIds.add(remoteAssignToBuddyGroupMethod_id);
+ buddyGroupOrganisationMethodIds.add(remoteRemoveFromBuddyGroupMethod_id);
+
+ blockUnblockMethodIds.add(blockChannelMethodLocal_id);
+ blockUnblockMethodIds.add(unblockChannelMethodLocal_id);
+
}
public static int lookupMethodId(Method method)
@@ -375,7 +413,7 @@
public static Method lookupMethod(int id)
{
- Method method = methods.get(id);
+ Method method = methods[id];
if (method == null)
{
if (log.isErrorEnabled())
@@ -392,39 +430,22 @@
*/
public static boolean isCrudMethod(int id)
{
- return isPutMethod(id) ||
- id == removeNodeMethodLocal_id ||
- id == removeKeyMethodLocal_id ||
- id == removeDataMethodLocal_id ||
- id == dataGravitationCleanupMethod_id ||
- id == moveMethodLocal_id ||
- id == removeNodeVersionedMethodLocal_id ||
- id == removeKeyVersionedMethodLocal_id ||
- id == removeDataVersionedMethodLocal_id;
+ return crudMethodIds.contains(Integer.valueOf(id));
}
public static boolean isTransactionLifecycleMethod(int id)
{
- // transactional lifecycle methods consist of just commit, rollback, prepare and optimistic prepare.
- return id == commitMethod_id || id == optimisticPrepareMethod_id || id == prepareMethod_id || id == rollbackMethod_id;
+ return transactionLifecycleMethodIds.contains(id);
}
public static boolean isBuddyGroupOrganisationMethod(int id)
{
- return id == remoteAssignToBuddyGroupMethod_id || id == remoteRemoveFromBuddyGroupMethod_id || id == remoteAnnounceBuddyPoolNameMethod_id;
+ return buddyGroupOrganisationMethodIds.contains(id);
}
public static boolean isPutMethod(int id)
{
- return
- id == putDataMethodLocal_id ||
- id == putDataEraseMethodLocal_id ||
- id == putKeyValMethodLocal_id ||
- id == putDataEraseVersionedMethodLocal_id ||
- id == putDataVersionedMethodLocal_id ||
- id == putKeyValVersionedMethodLocal_id ||
- id == putForExternalReadMethodLocal_id ||
- id == putForExternalReadVersionedMethodLocal_id;
+ return putMethodIds.contains(id);
}
public static boolean isGetMethod(int methodId)
@@ -435,7 +456,7 @@
public static boolean isBlockUnblockMethod(int id)
{
- return id == blockChannelMethodLocal_id || id == unblockChannelMethodLocal_id;
+ return blockUnblockMethodIds.contains(id);
}
/**
@@ -443,34 +464,7 @@
*/
public static Method getVersionedMethod(int methodId)
{
- if (isCrudMethod(methodId))
- {
- switch (methodId)
- {
- case putForExternalReadMethodLocal_id:
- return putForExternalReadVersionedMethodLocal;
- case putDataEraseMethodLocal_id:
- return putDataEraseVersionedMethodLocal;
- case putDataMethodLocal_id:
- return putDataVersionedMethodLocal;
- case putKeyValMethodLocal_id:
- return putKeyValVersionedMethodLocal;
- case removeDataMethodLocal_id:
- return removeDataVersionedMethodLocal;
- case removeKeyMethodLocal_id:
- return removeKeyVersionedMethodLocal;
- case removeNodeMethodLocal_id:
- return removeNodeVersionedMethodLocal;
- case moveMethodLocal_id:
- return moveMethodLocal;
- default:
- throw new CacheException("Unrecognised method id " + methodId);
- }
- }
- else
- {
- throw new CacheException("Attempting to look up a versioned equivalent of a non-crud method");
- }
+ return methods[getVersionedMethodId(methodId)];
}
/**
@@ -478,26 +472,48 @@
*/
public static Method getUnversionedMethod(int methodId)
{
+ return methods[getUnversionedMethodId(methodId)];
+ }
+
+
+ public static boolean isDataGravitationMethod(int methodId)
+ {
+ return methodId == MethodDeclarations.dataGravitationCleanupMethod_id || methodId == MethodDeclarations.dataGravitationMethod_id;
+ }
+
+ /**
+ * Tests whether remote calls to this method should return the value to the caller or just return a null (more efficient if the caller won't use this value anyway)
+ *
+ * @param methodId
+ * @return true if the caller expects the value to come back.
+ */
+ public static boolean returnValueForRemoteCall(int methodId)
+ {
+ return methodsThatNeedToReturnValuesToRemoteCallers.contains(methodId);
+ }
+
+ public static int getUnversionedMethodId(int methodId)
+ {
if (isCrudMethod(methodId))
{
switch (methodId)
{
case putForExternalReadVersionedMethodLocal_id:
- return putForExternalReadMethodLocal;
+ return putForExternalReadMethodLocal_id;
case putDataEraseVersionedMethodLocal_id:
- return putDataEraseMethodLocal;
+ return putDataEraseMethodLocal_id;
case putDataVersionedMethodLocal_id:
- return putDataMethodLocal;
+ return putDataMethodLocal_id;
case putKeyValVersionedMethodLocal_id:
- return putKeyValMethodLocal;
+ return putKeyValMethodLocal_id;
case removeDataVersionedMethodLocal_id:
- return removeDataMethodLocal;
+ return removeDataMethodLocal_id;
case removeKeyVersionedMethodLocal_id:
- return removeKeyMethodLocal;
+ return removeKeyMethodLocal_id;
case removeNodeVersionedMethodLocal_id:
- return removeNodeMethodLocal;
+ return removeNodeMethodLocal_id;
case moveMethodLocal_id:
- return moveMethodLocal;
+ return moveMethodLocal_id;
default:
throw new CacheException("Unrecognised method id " + methodId);
}
@@ -508,21 +524,36 @@
}
}
-
- public static boolean isDataGravitationMethod(int methodId)
+ public static int getVersionedMethodId(int methodId)
{
- return methodId == MethodDeclarations.dataGravitationCleanupMethod_id || methodId == MethodDeclarations.dataGravitationMethod_id;
+ if (isCrudMethod(methodId))
+ {
+ switch (methodId)
+ {
+ case putForExternalReadMethodLocal_id:
+ return putForExternalReadVersionedMethodLocal_id;
+ case putDataEraseMethodLocal_id:
+ return putDataEraseVersionedMethodLocal_id;
+ case putDataMethodLocal_id:
+ return putDataVersionedMethodLocal_id;
+ case putKeyValMethodLocal_id:
+ return putKeyValVersionedMethodLocal_id;
+ case removeDataMethodLocal_id:
+ return removeDataVersionedMethodLocal_id;
+ case removeKeyMethodLocal_id:
+ return removeKeyVersionedMethodLocal_id;
+ case removeNodeMethodLocal_id:
+ return removeNodeVersionedMethodLocal_id;
+ case moveMethodLocal_id:
+ return moveMethodLocal_id;
+ default:
+ throw new CacheException("Unrecognised method id " + methodId);
+ }
+ }
+ else
+ {
+ throw new CacheException("Attempting to look up a versioned equivalent of a non-crud method");
+ }
}
-
- /**
- * Tests whether remote calls to this method should return the value to the caller or just return a null (more efficient if the caller won't use this value anyway)
- *
- * @param methodId
- * @return true if the caller expects the value to come back.
- */
- public static boolean returnValueForRemoteCall(int methodId)
- {
- return methodsThatNeedToReturnValuesToRemoteCallers.contains(methodId);
- }
}
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -53,7 +53,8 @@
String marshallerClass = configuration.getMarshallerClass();
if (marshallerClass != null)
{
- log.trace("Cache marshaller implementation specified as " + marshallerClass + ". Overriding any version strings passed in. ");
+ if (trace)
+ log.trace("Cache marshaller implementation specified as " + marshallerClass + ". Overriding any version strings passed in. ");
try
{
defaultMarshaller = (Marshaller) Util.loadClass(marshallerClass).newInstance();
@@ -75,7 +76,7 @@
}
else
{
- log.debug("Using the marshaller passed in - " + defaultMarshaller);
+ if (log.isDebugEnabled()) log.debug("Using the marshaller passed in - " + defaultMarshaller);
versionInt = getCustomMarshallerVersionInt();
marshallers.put(versionInt, defaultMarshaller);
}
@@ -144,7 +145,7 @@
// based on the default marshaller, construct an object output stream based on what's compatible.
out = ObjectSerializationFactory.createObjectOutputStream(bos);
out.writeShort(versionInt);
- if (log.isTraceEnabled()) log.trace("Wrote version " + versionInt);
+ if (trace) log.trace("Wrote version " + versionInt);
//now marshall the contents of the object
defaultMarshaller.objectToObjectStream(obj, out);
@@ -163,7 +164,7 @@
{
in = ObjectSerializationFactory.createObjectInputStream(buf);
versionId = in.readShort();
- if (log.isTraceEnabled()) log.trace("Read version " + versionId);
+ if (trace) log.trace("Read version " + versionId);
}
catch (Exception e)
{
@@ -185,7 +186,7 @@
{
in = ObjectSerializationFactory.createObjectInputStream(is);
versionId = in.readShort();
- if (log.isTraceEnabled()) log.trace("Read version " + versionId);
+ if (trace) log.trace("Read version " + versionId);
}
catch (Exception e)
{
@@ -201,7 +202,7 @@
public void objectToObjectStream(Object obj, ObjectOutputStream out, Fqn region) throws Exception
{
out.writeShort(versionInt);
- if (log.isTraceEnabled()) log.trace("Wrote version " + versionInt);
+ if (trace) log.trace("Wrote version " + versionInt);
defaultMarshaller.objectToObjectStream(obj, out, region);
}
@@ -232,7 +233,7 @@
case VERSION_210:
knownVersion = true;
default:
- if (!knownVersion)
+ if (!knownVersion && log.isWarnEnabled())
log.warn("Unknown replication version String. Falling back to the default marshaller installed.");
marshaller = marshallers.get(VERSION_210);
if (marshaller == null)
@@ -251,7 +252,7 @@
public void objectToObjectStream(Object obj, ObjectOutputStream out) throws Exception
{
out.writeShort(versionInt);
- if (log.isTraceEnabled()) log.trace("Wrote version " + versionInt);
+ if (trace) log.trace("Wrote version " + versionInt);
defaultMarshaller.objectToObjectStream(obj, out);
}
@@ -262,7 +263,7 @@
try
{
versionId = in.readShort();
- if (log.isTraceEnabled()) log.trace("Read version " + versionId);
+ if (trace) log.trace("Read version " + versionId);
}
catch (Exception e)
{
Modified: core/trunk/src/main/java/org/jboss/cache/util/BitEncodedIntegerSet.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/BitEncodedIntegerSet.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/main/java/org/jboss/cache/util/BitEncodedIntegerSet.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -89,4 +89,14 @@
{
return "BitEncodedSet (encoded as: " + Long.toBinaryString(encoded) + ")";
}
+
+ /**
+ * Adds all elements of another BitEncodedIntegerSet to the current set.
+ *
+ * @param otherSet other set to add
+ */
+ public void addAll(BitEncodedIntegerSet otherSet)
+ {
+ encoded |= otherSet.encoded;
+ }
}
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyManagerTest.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -6,13 +6,6 @@
*/
package org.jboss.cache.buddyreplication;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
import org.jboss.cache.Fqn;
import org.jboss.cache.config.BuddyReplicationConfig;
import org.jboss.cache.factories.XmlConfigurationParser;
@@ -20,9 +13,13 @@
import org.jboss.cache.marshall.MethodCallFactory;
import org.jboss.cache.marshall.MethodDeclarations;
import org.jboss.cache.xml.XmlHelper;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.Test;
import org.w3c.dom.Element;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Tests the BuddyManager class
*
@@ -39,8 +36,8 @@
public void testConstruction1() throws Exception
{
String xmlConfig = "<config><buddyReplicationEnabled>true</buddyReplicationEnabled>\n" +
- " <buddyLocatorProperties>numBuddies = 3</buddyLocatorProperties>\n" +
- " <buddyPoolName>groupOne</buddyPoolName></config>";
+ " <buddyLocatorProperties>numBuddies = 3</buddyLocatorProperties>\n" +
+ " <buddyPoolName>groupOne</buddyPoolName></config>";
Element element = XmlHelper.stringToElement(xmlConfig);
BuddyReplicationConfig config = XmlConfigurationParser.parseBuddyReplicationConfig(element);
BuddyManager mgr = new BuddyManager(config);
@@ -61,9 +58,9 @@
public void testConstruction2() throws Exception
{
String xmlConfig = "<config><buddyReplicationEnabled>true</buddyReplicationEnabled>\n" +
- " <buddyLocatorClass>org.i.dont.exist.PhantomBuddyLocator</buddyLocatorClass>\n" +
- " <buddyLocatorProperties>numBuddies = 3</buddyLocatorProperties>\n" +
- " <buddyPoolName>groupOne</buddyPoolName></config>";
+ " <buddyLocatorClass>org.i.dont.exist.PhantomBuddyLocator</buddyLocatorClass>\n" +
+ " <buddyLocatorProperties>numBuddies = 3</buddyLocatorProperties>\n" +
+ " <buddyPoolName>groupOne</buddyPoolName></config>";
Element element = XmlHelper.stringToElement(xmlConfig);
BuddyReplicationConfig config = XmlConfigurationParser.parseBuddyReplicationConfig(element);
BuddyManager mgr = new BuddyManager(config);
@@ -135,8 +132,8 @@
{
Fqn fqn1 = Fqn.fromString("/hello/world");
- MethodCall call1 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, fqn1, "key", "value");
- MethodCall call2 = MethodCallFactory.create(MethodDeclarations.replicateMethod, call1);
+ MethodCall call1 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, fqn1, "key", "value");
+ MethodCall call2 = MethodCallFactory.create(MethodDeclarations.replicateMethod_id, call1);
BuddyManager bm = createBasicBuddyManager();
@@ -153,8 +150,8 @@
{
Fqn fqn1 = Fqn.ROOT;
- MethodCall call1 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, fqn1, "key", "value");
- MethodCall call2 = MethodCallFactory.create(MethodDeclarations.replicateMethod, call1);
+ MethodCall call1 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, fqn1, "key", "value");
+ MethodCall call2 = MethodCallFactory.create(MethodDeclarations.replicateMethod_id, call1);
BuddyManager bm = createBasicBuddyManager();
@@ -173,17 +170,17 @@
Fqn fqn3 = Fqn.fromString("/hello/again");
Fqn fqn4 = Fqn.fromString("/buddy/replication");
- MethodCall call1 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, fqn1, "key", "value");
- MethodCall call2 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, fqn2, "key", "value");
- MethodCall call3 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, fqn3, "key", "value");
- MethodCall call4 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, fqn4, "key", "value");
+ MethodCall call1 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, fqn1, "key", "value");
+ MethodCall call2 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, fqn2, "key", "value");
+ MethodCall call3 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, fqn3, "key", "value");
+ MethodCall call4 = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, fqn4, "key", "value");
List<MethodCall> list = new ArrayList<MethodCall>();
list.add(call1);
list.add(call2);
list.add(call3);
list.add(call4);
- MethodCall call5 = MethodCallFactory.create(MethodDeclarations.replicateAllMethod, list);
+ MethodCall call5 = MethodCallFactory.create(MethodDeclarations.replicateAllMethod_id, list);
BuddyManager bm = createBasicBuddyManager();
@@ -200,7 +197,8 @@
assertEquals(expected + "/buddy/replication", ((MethodCall) l.get(i)).getArgs()[0].toString());
}
- public void testGetActualFqn() {
+ public void testGetActualFqn()
+ {
Fqn<String> x = new Fqn<String>("x");
Fqn backup = BuddyManager.getBackupFqn("y", x);
assertEquals(x, BuddyManager.getActualFqn(backup));
Modified: core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -93,7 +93,7 @@
{
// make sure node that doesn't exist does not result in a node visit event.
- MethodCall mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal,
+ MethodCall mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal_id,
Fqn.fromString(fqn1));
interceptor.invoke(InvocationContext.fromMethodCall(mc));
Region regionABC = regionManager.getRegion(fqn1, false);
@@ -110,7 +110,7 @@
assertEquals("value", node.getDirect("key"));
- mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal,
+ mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal_id,
Fqn.fromString(fqn1));
interceptor.invoke(InvocationContext.fromMethodCall(mc));
@@ -120,7 +120,7 @@
assertEquals(fqn1, event.getFqn().toString());
assertNull(regionABC.takeLastEventNode());
- mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal,
+ mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal_id,
Fqn.fromString(fqn2));
interceptor.invoke(InvocationContext.fromMethodCall(mc));
@@ -130,7 +130,7 @@
assertEquals(fqn2, event.getFqn().toString());
assertNull(regionAB.takeLastEventNode());
- mc = MethodCallFactory.create(MethodDeclarations.getDataMapMethodLocal, Fqn.fromString(fqn3));
+ mc = MethodCallFactory.create(MethodDeclarations.getDataMapMethodLocal_id, Fqn.fromString(fqn3));
interceptor.invoke(InvocationContext.fromMethodCall(mc));
Region regionABD = regionManager.getRegion(fqn3, false);
event = regionABD.takeLastEventNode();
@@ -141,7 +141,7 @@
for (int i = 0; i < 10; i++)
{
Fqn fqn = Fqn.fromString(fqn3);
- mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal, fqn);
+ mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal_id, fqn);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
}
@@ -156,7 +156,7 @@
assertNull(regionManager.getRegion(fqn3, false).takeLastEventNode());
// check null handling.
- mc = MethodCallFactory.create(MethodDeclarations.getDataMapMethodLocal, new Object[]{null});
+ mc = MethodCallFactory.create(MethodDeclarations.getDataMapMethodLocal_id, new Object[]{null});
interceptor.invoke(InvocationContext.fromMethodCall(mc));
}
@@ -200,7 +200,7 @@
// aka MarshRegion.
Fqn fqn = Fqn.fromString(fqn4);
Object key = "key";
- MethodCall mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
+ MethodCall mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal_id, fqn, key, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
Region region = regionManager.getRegion(fqn.toString(), false);
assertNull(region.takeLastEventNode());
@@ -208,13 +208,13 @@
// add the node but try to get on a null element should result in no cache events being added to Region.
putQuietly(fqn, "wrongkey", "");
- mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
+ mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal_id, fqn, key, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
assertNull(region.takeLastEventNode());
// now make sure if we try to get on the node/key we just created in cache, that this DOES add a EvictedEventNode to
// the MarshRegion.
- mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, "wrongkey", false);
+ mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal_id, fqn, "wrongkey", false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
EvictedEventNode event = region.takeLastEventNode();
assertEquals(fqn, event.getFqn());
@@ -226,7 +226,7 @@
// test on element granularity configured node.
fqn = Fqn.fromString(fqn4);
- mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
+ mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal_id, fqn, key, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
region = regionManager.getRegion(fqn.toString(), false);
@@ -244,7 +244,7 @@
putQuietly("/d/e/g", key, "");
- mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, true);
+ mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal_id, fqn, key, true);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
}
@@ -260,7 +260,7 @@
putQuietly("/a/b/c", key, "");
fqn = Fqn.fromString("/a/b/c");
- mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
+ mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal_id, fqn, key, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
region = regionManager.getRegion(fqn.toString(), false);
@@ -276,7 +276,7 @@
putQuietly(fqn, key, "");
- mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, true);
+ mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal_id, fqn, key, true);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
}
@@ -301,7 +301,7 @@
// this region is node granularity
Fqn fqn = Fqn.fromString("/a/b/c");
- MethodCall mc = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, null, fqn, data, false);
+ MethodCall mc = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal_id, null, fqn, data, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
Region region = regionManager.getRegion(fqn.toString(), false);
@@ -322,7 +322,7 @@
for (int i = 0; i < 100; i++)
{
- mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, null, fqn, i,
+ mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, null, fqn, i,
"value", false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
@@ -340,7 +340,7 @@
assertNull(region.takeLastEventNode());
fqn = Fqn.fromString("/a/b");
- mc = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal, null, fqn, data, false, false);
+ mc = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal_id, null, fqn, data, false, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
event = regionManager.getRegion(fqn.toString(), false).takeLastEventNode();
assertFalse(event.isResetElementCount());
@@ -359,7 +359,7 @@
assertEquals(i, node.getDirect(i));
}
- mc = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal, null, fqn, data, false, true);
+ mc = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal_id, null, fqn, data, false, true);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
event = regionManager.getRegion(fqn.toString(), false).takeLastEventNode();
assertEquals(NodeEventType.ADD_NODE_EVENT, event.getEventType());
@@ -388,7 +388,7 @@
Object key = "key";
Object value = "value";
- MethodCall mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
+ MethodCall mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id,
null, fqn, key, value, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
assertEquals("value", cache.peek(fqn, false, false).getDirect(key));
@@ -399,7 +399,7 @@
assertEquals("value", cache.peek(fqn, false, false).getDirect(key));
assertNull(region.takeLastEventNode());
- mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
+ mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id,
null, fqn, key, value, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
assertEquals("value", cache.peek(fqn, false, false).getDirect(key));
@@ -418,7 +418,7 @@
putQuietly(fqn, "a", "b");
putQuietly(fqn, "b", "c");
- MethodCall mc = MethodCallFactory.create(MethodDeclarations.removeDataMethodLocal, null, fqn, false);
+ MethodCall mc = MethodCallFactory.create(MethodDeclarations.removeDataMethodLocal_id, null, fqn, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
assertEquals(0, cache.peek(fqn, false, false).getDataDirect().size());
@@ -428,7 +428,7 @@
assertEquals(fqn, event.getFqn());
assertNull(region.takeLastEventNode());
- mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, null, fqn, false);
+ mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal_id, null, fqn, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
assertNull(cache.peek(fqn, false, false));
@@ -444,7 +444,7 @@
putQuietly(fqn, "a", "b");
putQuietly(fqn, "b", "c");
- MethodCall mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal,
+ MethodCall mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal_id,
null, fqn, "a", false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
@@ -456,7 +456,7 @@
assertEquals(1, event.getElementDifference());
assertNull(region.takeLastEventNode());
- mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal,
+ mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal_id,
null, fqn, "b", false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
@@ -467,7 +467,7 @@
assertEquals(1, event.getElementDifference());
assertNull(region.takeLastEventNode());
- mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal,
+ mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal_id,
null, fqn, "b", false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
@@ -486,7 +486,7 @@
// this region is node granularity
Fqn fqn = Fqn.fromString("/a/b/c");
- MethodCall mc = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, null, fqn, data, false);
+ MethodCall mc = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal_id, null, fqn, data, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
Region region = regionManager.getRegion(fqn.toString(), false);
@@ -497,7 +497,7 @@
assertEquals(100, event.getElementDifference());
assertNull(region.takeLastEventNode());
- mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal,
+ mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal_id,
fqn);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
event = region.takeLastEventNode();
@@ -505,7 +505,7 @@
assertEquals(fqn, event.getFqn());
assertNull(region.takeLastEventNode());
- mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, null, fqn, false);
+ mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal_id, null, fqn, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
assertNull(cache.getNode(fqn));
event = region.takeLastEventNode();
@@ -515,7 +515,7 @@
Object key = "key";
Object value = "value";
- mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
+ mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id,
null, fqn, key, value, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
assertEquals("value", cache.peek(fqn, false, false).getDirect(key));
@@ -526,7 +526,7 @@
assertEquals("value", cache.peek(fqn, false, false).getDirect(key));
assertNull(region.takeLastEventNode());
- mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
+ mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal_id, fqn, key, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
region = regionManager.getRegion(fqn.toString(), false);
event = region.takeLastEventNode();
@@ -534,7 +534,7 @@
assertEquals(fqn, event.getFqn());
assertNull(region.takeLastEventNode());
- mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal,
+ mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal_id,
null, fqn, key, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ActiveInactiveTest.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -153,10 +153,10 @@
public void testObjectFromByteBuffer() throws Exception
{
- MethodCall put = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
+ MethodCall put = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id,
null, A_B, "name", "Joe", false);
- MethodCall replicate = MethodCallFactory.create(MethodDeclarations.replicateMethod, put);
+ MethodCall replicate = MethodCallFactory.create(MethodDeclarations.replicateMethod_id, put);
rman.setDefaultInactive(true);
// register A as an inactive marshalling region
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller200Test.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller200Test.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller200Test.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -92,7 +92,7 @@
final Fqn region = Fqn.fromString("/hello");
Region r = rm.getRegion(region, true);
r.registerContextClassLoader(this.getClass().getClassLoader());
- cm200.objectToObjectStream(MethodCallFactory.create(MethodDeclarations.clusteredGetMethod, null), oos, region);
+ cm200.objectToObjectStream(MethodCallFactory.create(MethodDeclarations.clusteredGetMethod_id, null), oos, region);
oos.close();
final byte[] stream = baos.toByteArray();
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller210Test.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller210Test.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshaller210Test.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -11,7 +11,7 @@
import java.util.HashMap;
import java.util.Map;
-@Test (groups = {"functional"})
+@Test(groups = {"functional"})
public class CacheMarshaller210Test extends CacheMarshaller200Test
{
public CacheMarshaller210Test()
@@ -26,8 +26,8 @@
Map map = createMap(size);
Fqn fqn = Fqn.fromString("/my/stuff");
String key = "key";
- MethodCall putMethod = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, fqn, key, map);
- MethodCall replicateMethod = MethodCallFactory.create(MethodDeclarations.replicateMethod, putMethod);
+ MethodCall putMethod = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, fqn, key, map);
+ MethodCall replicateMethod = MethodCallFactory.create(MethodDeclarations.replicateMethod_id, putMethod);
byte[] buf = marshaller.objectToByteBuffer(replicateMethod);
@@ -37,7 +37,7 @@
protected Map createMap(int size)
{
Map map = new HashMap(size);
- for (int i=0; i<size; i++) map.put("key-" + i, "value-" + i);
+ for (int i = 0; i < size; i++) map.put("key-" + i, "value-" + i);
return map;
}
@@ -52,11 +52,11 @@
CacheMarshaller210 cm210 = (CacheMarshaller210) marshaller.defaultMarshaller;
CacheMarshaller200 cm200 = (CacheMarshaller200) marshaller.getMarshaller(20);
int[] ints = {2, 100, 500, 12000, 20000, 500000, 2000000, Integer.MAX_VALUE};
-
+
for (int i : ints)
{
- System.out.println("CM200: Number of bytes (i="+i+") : " + getAndTestSize(cm200, i));
- System.out.println("CM210: Number of bytes (i="+i+") : " + getAndTestSize(cm210, i));
+ System.out.println("CM200: Number of bytes (i=" + i + ") : " + getAndTestSize(cm200, i));
+ System.out.println("CM210: Number of bytes (i=" + i + ") : " + getAndTestSize(cm210, i));
}
}
@@ -69,8 +69,8 @@
for (long i : ints)
{
- System.out.println("CM200: Number of bytes (i="+i+") : " + getAndTestSize(cm200, i));
- System.out.println("CM210: Number of bytes (i="+i+") : " + getAndTestSize(cm210, i));
+ System.out.println("CM200: Number of bytes (i=" + i + ") : " + getAndTestSize(cm200, i));
+ System.out.println("CM210: Number of bytes (i=" + i + ") : " + getAndTestSize(cm210, i));
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheMarshallerTestBase.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -132,7 +132,7 @@
public void testMethodCall() throws Exception
{
Fqn fqn = new Fqn<Object>(3, false);
- MethodCall call = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, fqn, "key", "value", true);
+ MethodCall call = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, fqn, "key", "value", true);
byte[] asBytes = marshaller.objectToByteBuffer(call);
Object o2 = marshaller.objectFromByteBuffer(asBytes);
@@ -145,8 +145,8 @@
public void testNestedMethodCall() throws Exception
{
Fqn fqn = new Fqn<Object>(3, false);
- MethodCall call = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, fqn, "key", "value", true);
- MethodCall replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod, call);
+ MethodCall call = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, fqn, "key", "value", true);
+ MethodCall replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod_id, call);
byte[] asBytes = marshaller.objectToByteBuffer(replicateCall);
Object o2 = marshaller.objectFromByteBuffer(asBytes);
assertTrue("Unmarshalled object should be a method call", o2 instanceof MethodCall);
@@ -235,17 +235,17 @@
Fqn f = new Fqn<Object>("BlahBlah", 3, false);
String k = "key", v = "value";
- MethodCall actualCall = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, null, f, k, v, true);
- MethodCall replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod, actualCall);
+ MethodCall actualCall = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, null, f, k, v, true);
+ MethodCall replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod_id, actualCall);
calls.add(replicateCall);
- actualCall = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, null, f, k, v, true);
- replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod, actualCall);
+ actualCall = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal_id, null, f, k, v, true);
+ replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod_id, actualCall);
calls.add(replicateCall);
- MethodCall call = MethodCallFactory.create(MethodDeclarations.replicateAllMethod, calls);
+ MethodCall call = MethodCallFactory.create(MethodDeclarations.replicateAllMethod_id, calls);
byte[] buf = marshaller.objectToByteBuffer(call);
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/MethodCallFactoryTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/MethodCallFactoryTest.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/MethodCallFactoryTest.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -13,7 +13,7 @@
public void testVarArgsMethod()
{
GlobalTransaction gtx = new GlobalTransaction();
- MethodCall c = MethodCallFactory.create(MethodDeclarations.commitMethod, gtx);
+ MethodCall c = MethodCallFactory.create(MethodDeclarations.commitMethod_id, gtx);
assertEquals(gtx, c.getArgs()[0]);
}
@@ -21,7 +21,7 @@
public void testObjectArrayMethod()
{
GlobalTransaction gtx = new GlobalTransaction();
- MethodCall c = MethodCallFactory.create(MethodDeclarations.commitMethod, gtx);
+ MethodCall c = MethodCallFactory.create(MethodDeclarations.commitMethod_id, gtx);
assertEquals(gtx, c.getArgs()[0]);
}
@@ -29,7 +29,7 @@
public void testMultipleArrayElems()
{
GlobalTransaction gtx = new GlobalTransaction();
- MethodCall c = MethodCallFactory.create(MethodDeclarations.commitMethod, gtx, gtx, gtx);
+ MethodCall c = MethodCallFactory.create(MethodDeclarations.commitMethod_id, gtx, gtx, gtx);
assertEquals(gtx, c.getArgs()[0]);
assertEquals(gtx, c.getArgs()[1]);
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/MethodIdPreservationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/MethodIdPreservationTest.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/MethodIdPreservationTest.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -32,12 +32,12 @@
{
byteStream = new ByteArrayOutputStream();
stream = new ObjectOutputStream(byteStream);
- call1 = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, Fqn.ROOT, null, null, true);
- call2 = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, Fqn.ROOT, null, null, true);
+ call1 = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal_id, Fqn.ROOT, null, null, true);
+ call2 = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal_id, Fqn.ROOT, null, null, true);
list.clear();
list.add(call1);
list.add(call2);
- prepareCall = MethodCallFactory.create(MethodDeclarations.prepareMethod, null, list, null, true);
+ prepareCall = MethodCallFactory.create(MethodDeclarations.prepareMethod_id, null, list, null, true);
}
public void testSingleMethodCall() throws Exception
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/RemoteCallerReturnValuesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/RemoteCallerReturnValuesTest.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/RemoteCallerReturnValuesTest.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -70,8 +70,8 @@
doNullReturnTest(MethodDeclarations.moveMethodLocal, fqn, Fqn.ROOT);
// ------------ Channel BLOCK event
- doNullReturnTest(MethodDeclarations.blockChannelLocal);
- doNullReturnTest(MethodDeclarations.unblockChannelLocal);
+ doNullReturnTest(MethodDeclarations.blockChannelMethodLocal);
+ doNullReturnTest(MethodDeclarations.unblockChannelMethodLocal);
}
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/ReturnValueMarshallingTest.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -85,8 +85,8 @@
assertSame(listClass, cache2.get(fqn, key).getClass());
// now test if this is the same when obtained using a clustered get mcall
- MethodCall call = MethodCallFactory.create(MethodDeclarations.clusteredGetMethod,
- MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false),
+ MethodCall call = MethodCallFactory.create(MethodDeclarations.clusteredGetMethod_id,
+ MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal_id, fqn, key, false),
false);
List responses = cache1.getRPCManager().callRemoteMethods(null, call, true, true, 15000);
@@ -114,7 +114,7 @@
assertSame(listClass, cache2.get(fqn, key).getClass());
// now test if this is the same when obtained using a data gravitate call
- MethodCall call = MethodCallFactory.create(MethodDeclarations.dataGravitationMethod,
+ MethodCall call = MethodCallFactory.create(MethodDeclarations.dataGravitationMethod_id,
fqn, false);
List responses = cache1.getRPCManager().callRemoteMethods(null, call, true, true, 15000);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/AbstractOptimisticTestCase.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -299,7 +299,7 @@
System.out.println("*** " + oa.length);
System.arraycopy(oa, 0, na, 0, oa.length);
na[oa.length] = new DefaultDataVersion();
- newList.add(MethodCallFactory.create(MethodDeclarations.getVersionedMethod(c.getMethodId()), na));
+ newList.add(MethodCallFactory.create(MethodDeclarations.getVersionedMethodId(c.getMethodId()), na));
}
return newList;
}
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/CacheTest.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -218,7 +218,7 @@
meth.getArgs()[0] = remoteGtx;
//call our remote method
- MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null,
+ MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null,
remoteGtx.getAddress(), Boolean.FALSE);
TestingUtil.getRemoteDelegate(c)._replicate(prepareMethod);
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -81,8 +81,8 @@
List calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(0));
- assertEquals(MethodDeclarations.commitMethod, calls.get(1));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
+ assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
}
public void testRollbackTransaction() throws Exception
@@ -108,7 +108,7 @@
List calls = dummy.getAllCalled();
assertEquals(1, calls.size());
- assertEquals(MethodDeclarations.rollbackMethod, calls.get(0));
+ assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(0));
}
public void testRemotePrepareTransaction() throws Exception
@@ -144,7 +144,7 @@
meth.getArgs()[0] = remoteGtx;
//call our remote method
- MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), false);
+ MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), false);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
@@ -167,7 +167,7 @@
assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
assertEquals(1, entry.getModifications().size());
List calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(2));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
@@ -209,7 +209,7 @@
meth.getArgs()[0] = remoteGtx;
//call our remote method
- MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), false);
+ MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), false);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
@@ -231,14 +231,14 @@
assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
assertEquals(1, entry.getModifications().size());
List calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(2));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());
// call our remote method
- MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod, remoteGtx);
+ MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod_id, remoteGtx);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(rollbackMethod);
@@ -249,7 +249,7 @@
}
//we should have the commit as well now
assertNull(mgr.getTransaction());
- assertEquals(MethodDeclarations.rollbackMethod, calls.get(3));
+ assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(3));
assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
}
@@ -297,7 +297,7 @@
assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
// call our remote method
- MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod, remoteGtx);
+ MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod_id, remoteGtx);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(commitMethod);
@@ -358,7 +358,7 @@
assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
// call our remote method
- MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod, remoteGtx);
+ MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod_id, remoteGtx);
TestingUtil.getRemoteDelegate(cache)._replicate(rollbackMethod);
assertTrue("Should be handled on the remote end without barfing, in the event of a rollback without a prepare", true);
@@ -404,7 +404,7 @@
meth.getArgs()[0] = remoteGtx;
//call our remote method
- MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), false);
+ MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), false);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
@@ -427,14 +427,14 @@
assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
assertEquals(1, entry.getModifications().size());
List calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(2));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());
// call our remote method
- MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod, remoteGtx);
+ MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod_id, remoteGtx);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(commitMethod);
@@ -445,7 +445,7 @@
}
//we should have the commit as well now
assertNull(mgr.getTransaction());
- assertEquals(MethodDeclarations.commitMethod, calls.get(3));
+ assertEquals(MethodDeclarations.commitMethod_id, calls.get(3));
assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
}
@@ -493,12 +493,12 @@
List calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(0));
- assertEquals(MethodDeclarations.commitMethod, calls.get(1));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
+ assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
List calls2 = dummy2.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls2.get(0));
- assertEquals(MethodDeclarations.commitMethod, calls2.get(1));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls2.get(0));
+ assertEquals(MethodDeclarations.commitMethod_id, calls2.get(1));
destroyCache(cache2);
}
@@ -555,12 +555,12 @@
List calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(0));
- assertEquals(MethodDeclarations.rollbackMethod, calls.get(1));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
+ assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(1));
//we have no prepare - as it failed - but we have a commit
List calls2 = dummy2.getAllCalled();
- assertEquals(MethodDeclarations.rollbackMethod, calls2.get(0));
+ assertEquals(MethodDeclarations.rollbackMethod_id, calls2.get(0));
destroyCache(cache2);
}
@@ -619,7 +619,7 @@
List calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.rollbackMethod, calls.get(0));
+ assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(0));
//we have no prepare - as it failed - but we have a commit
List calls2 = dummy2.getAllCalled();
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/TxInterceptorTest.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -55,8 +55,8 @@
List<?> calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(0));
- assertEquals(MethodDeclarations.commitMethod, calls.get(1));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
+ assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
//flesh this out a bit more
}
@@ -89,8 +89,8 @@
assertNull(mgr.getTransaction());
List<?> calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(0));
- assertEquals(MethodDeclarations.commitMethod, calls.get(1));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
+ assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
@@ -121,7 +121,7 @@
List<?> calls = dummy.getAllCalled();
assertEquals(1, calls.size());
- assertEquals(MethodDeclarations.rollbackMethod, calls.get(0));
+ assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(0));
assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
@@ -207,8 +207,8 @@
assertNull(mgr.getTransaction());
List<?> calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(0));
- assertEquals(MethodDeclarations.commitMethod, calls.get(1));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
+ assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
boolean failed = false;
try
{
@@ -254,8 +254,8 @@
assertNull(mgr.getTransaction());
List<?> calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(0));
- assertEquals(MethodDeclarations.commitMethod, calls.get(1));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
+ assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
@@ -291,8 +291,8 @@
//test local calls
List<?> calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(0));
- assertEquals(MethodDeclarations.commitMethod, calls.get(1));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
+ assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
assertNull(mgr.getTransaction());
assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
@@ -307,7 +307,7 @@
meth.getArgs()[0] = remoteGtx;
//call our remote method
- MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
+ MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
@@ -326,7 +326,7 @@
//assert that the method has been passed up the stack
calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(2));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
//assert we have the tx in th table
assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
@@ -367,7 +367,7 @@
meth.getArgs()[0] = remoteGtx;
//call our remote method
- MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
+ MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
@@ -387,7 +387,7 @@
List<?> calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(0));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
//assert we have two current transactions
assertEquals(2, cache.getTransactionTable().getNumGlobalTransactions());
@@ -398,8 +398,8 @@
//check local calls
calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(1));
- assertEquals(MethodDeclarations.commitMethod, calls.get(2));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(1));
+ assertEquals(MethodDeclarations.commitMethod_id, calls.get(2));
//assert we have only 1 transaction left
@@ -451,7 +451,7 @@
meth.getArgs()[0] = remoteGtx;
//call our remote method
- MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
+ MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
@@ -465,7 +465,7 @@
assertEquals(2, cache.getTransactionTable().getNumLocalTransactions());
// call our remote method
- MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod, remoteGtx);
+ MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod_id, remoteGtx);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(commitMethod);
@@ -484,8 +484,8 @@
assertNull(table.getLocalTransaction(remoteGtx));
List<?> calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(0));
- assertEquals(MethodDeclarations.commitMethod, calls.get(1));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
+ assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());
@@ -494,8 +494,8 @@
mgr.commit();
calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(2));
- assertEquals(MethodDeclarations.commitMethod, calls.get(3));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
+ assertEquals(MethodDeclarations.commitMethod_id, calls.get(3));
assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
@@ -540,7 +540,7 @@
meth.getArgs()[0] = remoteGtx;
//call our remote method
- MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
+ MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
@@ -554,7 +554,7 @@
assertEquals(2, cache.getTransactionTable().getNumLocalTransactions());
// call our remote method
- MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod, remoteGtx);
+ MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod_id, remoteGtx);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(rollbackMethod);
@@ -572,8 +572,8 @@
assertNull(table.getLocalTransaction(remoteGtx));
List<?> calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(0));
- assertEquals(MethodDeclarations.rollbackMethod, calls.get(1));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
+ assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(1));
assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());
@@ -582,8 +582,8 @@
mgr.commit();
calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(2));
- assertEquals(MethodDeclarations.commitMethod, calls.get(3));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
+ assertEquals(MethodDeclarations.commitMethod_id, calls.get(3));
assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
@@ -621,8 +621,8 @@
//test local calls
List<?> calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(0));
- assertEquals(MethodDeclarations.commitMethod, calls.get(1));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
+ assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
assertNull(mgr.getTransaction());
@@ -639,7 +639,7 @@
meth.getArgs()[0] = remoteGtx;
//call our remote method
- MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
+ MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
@@ -661,11 +661,11 @@
assertEquals(1, table.get(remoteGtx).getModifications().size());
calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(2));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
assertNull(mgr.getTransaction());
// call our remote method
- MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod, remoteGtx, Boolean.TRUE);
+ MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod_id, remoteGtx, Boolean.TRUE);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(commitMethod);
@@ -713,8 +713,8 @@
//test local calls
List<?> calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(0));
- assertEquals(MethodDeclarations.commitMethod, calls.get(1));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
+ assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
GlobalTransaction remoteGtx = new GlobalTransaction();
@@ -725,7 +725,7 @@
meth.getArgs()[0] = remoteGtx;
//call our remote method
- MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
+ MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
@@ -745,10 +745,10 @@
assertEquals(1, table.get(remoteGtx).getModifications().size());
calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(2));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
// call our remote method
- MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod, remoteGtx);
+ MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod_id, remoteGtx);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(rollbackMethod);
@@ -759,8 +759,8 @@
}
calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(2));
- assertEquals(MethodDeclarations.rollbackMethod, calls.get(3));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
+ assertEquals(MethodDeclarations.rollbackMethod_id, calls.get(3));
assertNull(table.get(remoteGtx));
assertNull(table.getLocalTransaction(remoteGtx));
@@ -801,11 +801,11 @@
List<?> calls = dummy.getAllCalled();
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(0));
- assertEquals(MethodDeclarations.commitMethod, calls.get(1));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
+ assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
- assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(2));
- assertEquals(MethodDeclarations.commitMethod, calls.get(3));
+ assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));
+ assertEquals(MethodDeclarations.commitMethod_id, calls.get(3));
cache.stop();
}
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ValidatorInterceptorTest.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -107,7 +107,7 @@
assertEquals(null, dummy.getCalled());
//now let us do a prepare
- MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, gtx, entry.getModifications(), null, gtx.getAddress(), Boolean.FALSE);
+ MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, gtx, entry.getModifications(), null, gtx.getAddress(), Boolean.FALSE);
TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
@@ -159,7 +159,7 @@
//lets change one of the underlying version numbers
workspace.getNode(Fqn.fromString("/one/two")).getNode().setVersion(new DefaultDataVersion(2));
//now let us do a prepare
- MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, gtx, entry.getModifications(), null, gtx.getAddress(), Boolean.FALSE);
+ MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, gtx, entry.getModifications(), null, gtx.getAddress(), Boolean.FALSE);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
@@ -206,7 +206,7 @@
//lets change one of the underlying version numbers
//now let us do a prepare
- MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, gtx, entry.getModifications(), null, gtx.getAddress(), Boolean.FALSE);
+ MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, gtx, entry.getModifications(), null, gtx.getAddress(), Boolean.FALSE);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
@@ -217,7 +217,7 @@
assertTrue(true);
}
- MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod, gtx);
+ MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod_id, gtx);
TestingUtil.getRemoteDelegate(cache)._replicate(commitMethod);
@@ -283,7 +283,7 @@
//lets change one of the underlying version numbers
//now let us do a prepare
- MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, gtx, entry.getModifications(), null, gtx.getAddress(), Boolean.FALSE);
+ MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, gtx, entry.getModifications(), null, gtx.getAddress(), Boolean.FALSE);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
@@ -295,7 +295,7 @@
}
- MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod, gtx);
+ MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod_id, gtx);
TestingUtil.getRemoteDelegate(cache)._replicate(commitMethod);
@@ -362,7 +362,7 @@
//lets change one of the underlying version numbers
//now let us do a prepare
- MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, gtx, entry.getModifications(), null, gtx.getAddress(), Boolean.FALSE);
+ MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, gtx, entry.getModifications(), null, gtx.getAddress(), Boolean.FALSE);
try
{
@@ -374,7 +374,7 @@
assertTrue(true);
}
- MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod, gtx);
+ MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod_id, gtx);
TestingUtil.getRemoteDelegate(cache)._replicate(rollbackMethod);
Modified: core/trunk/src/test/java/org/jboss/cache/util/BitEncodedIntegerSetTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/BitEncodedIntegerSetTest.java 2008-01-04 09:45:35 UTC (rev 4976)
+++ core/trunk/src/test/java/org/jboss/cache/util/BitEncodedIntegerSetTest.java 2008-01-04 12:19:46 UTC (rev 4977)
@@ -55,6 +55,59 @@
}
+ public void testAddAll()
+ {
+ BitEncodedIntegerSet set = new BitEncodedIntegerSet();
+ set.add(0);
+ set.add(1);
+ set.add(62);
+ set.add(63);
+
+ for (int i = 0; i < 64; i++)
+ {
+ if (i == 0 || i == 1 || i == 62 || i == 63)
+ {
+ assert set.contains(i);
+ }
+ else
+ {
+ assert !set.contains(i);
+ }
+ }
+
+ BitEncodedIntegerSet set2 = new BitEncodedIntegerSet();
+ set2.add(0);
+ set2.add(1);
+ set2.add(44);
+ set2.add(55);
+
+ for (int i = 0; i < 64; i++)
+ {
+ if (i == 0 || i == 1 || i == 44 || i == 55)
+ {
+ assert set2.contains(i);
+ }
+ else
+ {
+ assert !set2.contains(i);
+ }
+ }
+
+ set.addAll(set2);
+
+ for (int i = 0; i < 64; i++)
+ {
+ if (i == 0 || i == 1 || i == 62 || i == 63 || i == 44 || i == 55)
+ {
+ assert set.contains(i) : "Should contain " + i;
+ }
+ else
+ {
+ assert !set.contains(i);
+ }
+ }
+ }
+
public void testClear()
{
BitEncodedIntegerSet set = new BitEncodedIntegerSet();
16 years, 11 months