User: slaboure Date: 02/01/13 08:28:55 Modified: src/main/org/jboss/invocation MarshalledInvocation.java Log: Make Externalizable calls (writeExternal) idempotent: until now, serialization on a MarshalledInvocation could only performed once (transaction was removed and METHOD type was modified). If another call was re-using the same object (in clustering for example), the call was making a ClassCastException because of the changed METHOD type in the Map that occured in the previous call to writeExternal) Revision Changes Path 1.3 +20 -7 jboss/src/main/org/jboss/invocation/MarshalledInvocation.java Index: MarshalledInvocation.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/invocation/MarshalledInvocation.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MarshalledInvocation.java 2001/12/31 20:49:21 1.2 +++ MarshalledInvocation.java 2002/01/13 16:28:55 1.3 @@ -58,7 +58,7 @@ * * @see <related> * @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a> -* @version $Revision: 1.2 $ +* @version $Revision: 1.3 $ * Revisions: * * <p><b>Revisions:</b> @@ -67,6 +67,14 @@ * <ul> * <li> Initial check-in * </ul> +* <p><b>20020113 Sacha Labourey:</b> +* <ul> +* <li> Make Externalizable calls (writeExternal) idempotent: until now, +* serialization on a MarshalledInvocation could only performed once (transaction was removed +* and METHOD type was modified). If another call was re-using the same object (in +* clustering for example), the call was making a ClassCastException because of +* the changed METHOD type in the Map that occured in the previous call to writeExternal) +* </ul> */ public class MarshalledInvocation extends Invocation @@ -286,11 +294,9 @@ // Write the TPC, not the local transaction out.writeObject(tpc); - payload.remove(TRANSACTION); - - // We write the hash instead of the method - payload.put(METHOD, new Long(calculateHash((Method) payload.remove(METHOD)))); + HashMap sentData = new HashMap (); + // Everything else is possibly tied to classloaders that exist inside the server but not in // the generic JMX land. // they will travel in the payload as Marshalled Object, see the Invocation getter logic @@ -309,11 +315,18 @@ // Bench the above for speed. //Replace the current object with a Marshalled representation - payload.put(currentKey, new MarshalledObject(payload.get(currentKey))); + if (currentKey != TRANSACTION) + { + if (currentKey == METHOD) + // We write the hash instead of the method + sentData.put(METHOD, new Long(calculateHash((Method) payload.get(METHOD)))); + else + sentData.put (currentKey, new MarshalledObject(payload.get(currentKey))); + } } // The map contains only serialized representations of every other object - out.writeObject(payload); + out.writeObject(sentData); } public void readExternal(java.io.ObjectInput in)
_______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development