Author: manik.surtani(a)jboss.com
Date: 2008-01-03 21:36:51 -0500 (Thu, 03 Jan 2008)
New Revision: 4974
Modified:
core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
Log:
Perf improvements
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
01:59:48 UTC (rev 4973)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-01-04
02:36:51 UTC (rev 4974)
@@ -230,11 +230,11 @@
private Fqn extractFqnRegion(MethodCall call) throws Exception
{
Fqn fqn;
- if (call.getMethod().equals(MethodDeclarations.replicateMethod))
+ if (isReplicateMethod(call))
{
fqn = extractFqnFromMethodCall(call);
}
- else if (call.getMethod().equals(MethodDeclarations.replicateAllMethod))
+ else if (isReplicateAllMethod(call))
{
fqn = extractFqnFromListOfMethodCall(call);
}
@@ -247,6 +247,15 @@
return r == null ? null : r.getFqn();
}
+ protected boolean isReplicateMethod(MethodCall call)
+ {
+ return call.getMethodId() == MethodDeclarations.replicateMethod_id ||
call.getMethod().equals(MethodDeclarations.replicateMethod);
+ }
+
+ protected boolean isReplicateAllMethod(MethodCall call)
+ {
+ return call.getMethodId() == MethodDeclarations.replicateAllMethod_id ||
call.getMethod().equals(MethodDeclarations.replicateAllMethod);
+ }
// --------- Marshalling methods
private void marshallObject(Object o, ObjectOutputStream out, Map<Object,
Integer> refMap) throws Exception
@@ -445,9 +454,9 @@
if (!isRoot)
{
out.writeShort(fqn.size());
- for (int i = 0; i < fqn.size(); i++)
+ for (Object o : fqn.peekElements())
{
- marshallObject(fqn.get(i), out, refMap);
+ marshallObject(o, out, refMap);
}
}
}