[jboss-cvs] JBossCache/src/org/jboss/cache/marshall ...

Manik Surtani msurtani at jboss.com
Tue Sep 5 09:12:53 EDT 2006


  User: msurtani
  Date: 06/09/05 09:12:53

  Modified:    src/org/jboss/cache/marshall  TreeCacheMarshaller200.java
  Log:
  Updated to use JBoss Serialization's large string handling
  
  Revision  Changes    Path
  1.4       +12 -9     JBossCache/src/org/jboss/cache/marshall/TreeCacheMarshaller200.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TreeCacheMarshaller200.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/marshall/TreeCacheMarshaller200.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- TreeCacheMarshaller200.java	30 Aug 2006 17:08:18 -0000	1.3
  +++ TreeCacheMarshaller200.java	5 Sep 2006 13:12:53 -0000	1.4
  @@ -12,6 +12,7 @@
   import org.jboss.cache.Fqn;
   import org.jboss.cache.GlobalTransaction;
   import org.jboss.cache.rpc.RpcTreeCache;
  +import org.jboss.serial.util.StringUtil;
   import org.jgroups.Address;
   import org.jgroups.stack.IpAddress;
   
  @@ -199,13 +200,6 @@
            }
            else
            {
  -            // treat this as a serializable object
  -//                if (log.isWarnEnabled()) log.warn("Treating method call " + call + " as a normal Serializable object, not attempting to marshall with method ids.");
  -//
  -//                int refId = createReference(o, refMap);
  -//                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?");
            }
         }
  @@ -253,7 +247,7 @@
            int refId = createReference(o, refMap);
            out.writeByte(TreeCacheMarshaller200.MAGICNUMBER_STRING);
            out.writeShort(refId);
  -         out.writeUTF((String) o);
  +         marshallString((String) o, out);
         }
         else if (o instanceof Map)
         {
  @@ -284,6 +278,11 @@
         return reference;
      }
   
  +   private void marshallString(String s, ObjectOutputStream out) throws Exception
  +   {
  +      StringUtil.saveString(out, s);
  +   }
  +
      private void marshallMethodCall(MethodCall methodCall, ObjectOutputStream out, Map refMap) throws Exception
      {
         out.writeShort(methodCall.getMethodId());
  @@ -418,7 +417,7 @@
               return retVal;
            case TreeCacheMarshaller200.MAGICNUMBER_STRING:
               reference = new Integer(in.readShort());
  -            retVal = in.readUTF();
  +            retVal = unmarshallString(in);
               refMap.put(reference, retVal);
               return retVal;
            case TreeCacheMarshaller200.MAGICNUMBER_MAP:
  @@ -432,6 +431,10 @@
         }
      }
   
  +   private String unmarshallString(ObjectInputStream in) throws Exception
  +   {
  +      return StringUtil.readString(in, null);
  +   }
   
      private MethodCall unmarshallMethodCall(ObjectInputStream in, Map refMap) throws Exception
      {
  
  
  



More information about the jboss-cvs-commits mailing list