[jboss-cvs] JBossCache/src/org/jboss/cache/marshall ...
Manik Surtani
msurtani at jboss.com
Sat Nov 11 12:50:05 EST 2006
User: msurtani
Date: 06/11/11 12:50:05
Modified: src/org/jboss/cache/marshall Tag: Branch_JBossCache_1_4_0
MethodDeclarations.java TreeCacheMarshaller140.java
Log:
JBCACHE-843
Revision Changes Path
No revision
No revision
1.8.2.1 +147 -11 JBossCache/src/org/jboss/cache/marshall/MethodDeclarations.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MethodDeclarations.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/marshall/MethodDeclarations.java,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -b -r1.8 -r1.8.2.1
--- MethodDeclarations.java 7 Jun 2006 22:28:08 -0000 1.8
+++ MethodDeclarations.java 11 Nov 2006 17:50:05 -0000 1.8.2.1
@@ -32,7 +32,7 @@
* allowing lookup operations both ways.
*
* @author <a href="galder.zamarreno at jboss.com">Galder Zamarreno</a>
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.8.2.1 $
*/
public class MethodDeclarations
{
@@ -40,6 +40,7 @@
private static Set crud_methods = new HashSet();
private static Set crud_method_ids = new HashSet();
+ private static Set optimisticPutMethods = new HashSet();
// maintain a list of method IDs that correspond to Methods in TreeCache
private static Map methods = new HashMap();
@@ -117,6 +118,22 @@
public static final Method dataGravitationMethod;
+ // these are basic crud methods that are version-aware - JBCACHE-843.
+
+ public static final Method putDataVersionedMethodLocal;
+
+ public static final Method putDataEraseVersionedMethodLocal;
+
+ public static final Method putKeyValVersionedMethodLocal;
+
+ public static final Method removeNodeVersionedMethodLocal;
+
+ public static final Method removeKeyVersionedMethodLocal;
+
+ public static final Method removeDataVersionedMethodLocal;
+
+
+
//not all of these are used for RPC - trim accordingly.
public static final int putDataMethodLocal_id = 1;
@@ -189,6 +206,21 @@
public static final int dataGravitationMethod_id = 35;
+ // these are basic crud methods that are version-aware - JBCACHE-843.
+
+ public static final int putDataVersionedMethodLocal_id = 36;
+
+ public static final int putDataEraseVersionedMethodLocal_id = 37;
+
+ public static final int putKeyValVersionedMethodLocal_id = 38;
+
+ public static final int removeNodeVersionedMethodLocal_id = 39;
+
+ public static final int removeKeyVersionedMethodLocal_id = 40;
+
+ public static final int removeDataVersionedMethodLocal_id = 41;
+
+
static
{
try
@@ -273,7 +305,19 @@
dataGravitationCleanupMethod = TreeCache.class.getDeclaredMethod("_dataGravitationCleanup", new Class[]{GlobalTransaction.class, Fqn.class, Fqn.class});
dataGravitationMethod = TreeCache.class.getDeclaredMethod("_gravitateData", new Class[]{Fqn.class, boolean.class, boolean.class});
-
+ // version-aware methods - see JBCACHE-843
+ putDataVersionedMethodLocal = TreeCache.class.getDeclaredMethod("_put", new Class[]
+ {GlobalTransaction.class, Fqn.class, Map.class, boolean.class, DataVersion.class});
+ putDataEraseVersionedMethodLocal = TreeCache.class.getDeclaredMethod("_put", new Class[]
+ {GlobalTransaction.class, Fqn.class, Map.class, boolean.class, boolean.class, DataVersion.class});
+ putKeyValVersionedMethodLocal = TreeCache.class.getDeclaredMethod("_put", new Class[]
+ {GlobalTransaction.class, Fqn.class, Object.class, Object.class, boolean.class, DataVersion.class});
+ removeNodeVersionedMethodLocal = TreeCache.class.getDeclaredMethod("_remove", new Class[]
+ {GlobalTransaction.class, Fqn.class, boolean.class, DataVersion.class});
+ removeKeyVersionedMethodLocal = TreeCache.class.getDeclaredMethod("_remove", new Class[]
+ {GlobalTransaction.class, Fqn.class, Object.class, boolean.class, DataVersion.class});
+ removeDataVersionedMethodLocal = TreeCache.class.getDeclaredMethod("_removeData", new Class[]
+ {GlobalTransaction.class, Fqn.class, boolean.class, DataVersion.class});
}
catch (NoSuchMethodException ex)
{
@@ -281,15 +325,6 @@
throw new ExceptionInInitializerError(ex.toString());
}
- crud_methods.add(putDataMethodLocal);
- crud_methods.add(putDataEraseMethodLocal);
- crud_methods.add(putKeyValMethodLocal);
- crud_methods.add(putFailFastKeyValueMethodLocal);
- crud_methods.add(removeNodeMethodLocal);
- crud_methods.add(removeKeyMethodLocal);
- crud_methods.add(removeDataMethodLocal);
- crud_methods.add(dataGravitationCleanupMethod);
-
methods.put(new Integer(putDataMethodLocal_id), putDataMethodLocal);
methods.put(new Integer(putDataEraseMethodLocal_id), putDataEraseMethodLocal);
methods.put(new Integer(putKeyValMethodLocal_id), putKeyValMethodLocal);
@@ -328,6 +363,13 @@
methods.put(new Integer(dataGravitationCleanupMethod_id), dataGravitationCleanupMethod);
methods.put(new Integer(dataGravitationMethod_id), dataGravitationMethod);
+ methods.put(new Integer(putDataVersionedMethodLocal_id), putDataVersionedMethodLocal);
+ methods.put(new Integer(putDataEraseVersionedMethodLocal_id), putDataEraseVersionedMethodLocal);
+ methods.put(new Integer(putKeyValVersionedMethodLocal_id), putKeyValVersionedMethodLocal);
+ methods.put(new Integer(removeDataVersionedMethodLocal_id), removeDataVersionedMethodLocal);
+ methods.put(new Integer(removeKeyVersionedMethodLocal_id), removeKeyVersionedMethodLocal);
+ methods.put(new Integer(removeNodeVersionedMethodLocal_id), removeNodeVersionedMethodLocal);
+
Iterator it = methods.keySet().iterator();
while (it.hasNext())
{
@@ -344,6 +386,36 @@
crud_method_ids.add(new Integer(removeKeyMethodLocal_id));
crud_method_ids.add(new Integer(removeDataMethodLocal_id));
crud_method_ids.add(new Integer(dataGravitationCleanupMethod_id));
+ crud_method_ids.add(new Integer(putDataVersionedMethodLocal_id));
+ crud_method_ids.add(new Integer(putDataEraseVersionedMethodLocal_id));
+ crud_method_ids.add(new Integer(putKeyValVersionedMethodLocal_id));
+ crud_method_ids.add(new Integer(removeNodeVersionedMethodLocal_id));
+ crud_method_ids.add(new Integer(removeKeyVersionedMethodLocal_id));
+ crud_method_ids.add(new Integer(removeDataVersionedMethodLocal_id));
+
+ crud_methods.add(putDataMethodLocal);
+ crud_methods.add(putDataEraseMethodLocal);
+ crud_methods.add(putKeyValMethodLocal);
+ crud_methods.add(putFailFastKeyValueMethodLocal);
+ crud_methods.add(removeNodeMethodLocal);
+ crud_methods.add(removeKeyMethodLocal);
+ crud_methods.add(removeDataMethodLocal);
+ crud_methods.add(dataGravitationCleanupMethod);
+ crud_methods.add(putDataVersionedMethodLocal);
+ crud_methods.add(putDataEraseVersionedMethodLocal);
+ crud_methods.add(putKeyValVersionedMethodLocal);
+ crud_methods.add(removeDataVersionedMethodLocal);
+ crud_methods.add(removeNodeVersionedMethodLocal);
+ crud_methods.add(removeKeyVersionedMethodLocal);
+
+ optimisticPutMethods.add(putDataEraseMethodLocal);
+ optimisticPutMethods.add(putDataMethodLocal);
+ optimisticPutMethods.add(putKeyValMethodLocal);
+ optimisticPutMethods.add(putDataEraseVersionedMethodLocal);
+ optimisticPutMethods.add(putDataVersionedMethodLocal);
+ optimisticPutMethods.add(putKeyValVersionedMethodLocal);
+
+
}
protected static int lookupMethodId(Method method)
@@ -392,4 +464,68 @@
{
return crud_method_ids.contains(new Integer(id));
}
+
+ /**
+ * Returns the versioned equivalent of a crud method.
+ */
+ public static Method getVersionedMethod(int methodId)
+ {
+ if (isCrudMethod(methodId))
+ {
+ switch (methodId)
+ {
+ 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;
+ default:
+ throw new RuntimeException("Unrecognised method id " + methodId);
+ }
+ }
+ else throw new RuntimeException("Attempting to look up a versioned equivalent of a non-crud method");
+ }
+
+ /**
+ * Returns true if the method passed in is one of the put or put-with-versioning methods.
+ */
+ public static boolean isOptimisticPutMethod(Method method)
+ {
+ return optimisticPutMethods.contains(method);
+ }
+
+ /**
+ * Counterpart to {@link #getVersionedMethod(int)}
+ */
+ public static Method getUnversionedMethod(int methodId)
+ {
+ if (isCrudMethod(methodId))
+ {
+ switch (methodId)
+ {
+ case putDataEraseVersionedMethodLocal_id:
+ return putDataEraseMethodLocal;
+ case putDataVersionedMethodLocal_id:
+ return putDataMethodLocal;
+ case putKeyValVersionedMethodLocal_id:
+ return putKeyValMethodLocal;
+ case removeDataVersionedMethodLocal_id:
+ return removeDataMethodLocal;
+ case removeKeyVersionedMethodLocal_id:
+ return removeKeyMethodLocal;
+ case removeNodeVersionedMethodLocal_id:
+ return removeNodeMethodLocal;
+ default:
+ throw new RuntimeException("Unrecognised method id " + methodId);
+ }
+ }
+ else throw new RuntimeException("Attempting to look up a versioned equivalent of a non-crud method");
+ }
}
1.1.2.2 +1 -1 JBossCache/src/org/jboss/cache/marshall/Attic/TreeCacheMarshaller140.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TreeCacheMarshaller140.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/marshall/Attic/TreeCacheMarshaller140.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- TreeCacheMarshaller140.java 7 Jul 2006 07:20:02 -0000 1.1.2.1
+++ TreeCacheMarshaller140.java 11 Nov 2006 17:50:05 -0000 1.1.2.2
@@ -220,7 +220,7 @@
// out.writeByte(MAGICNUMBER_SERIALIZABLE);
// out.writeShort(refId);
// out.writeObject(call);
- throw new IllegalArgumentException("MethodCall does not have a valid method id. Was this method call created with MethodCallFactory?");
+ throw new IllegalArgumentException("MethodCall "+call+" does not have a valid method id. Was this method call created with MethodCallFactory?");
}
}
else if (o instanceof Fqn)
More information about the jboss-cvs-commits
mailing list