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();