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

Manik Surtani msurtani at jboss.com
Fri Jan 19 07:05:41 EST 2007


  User: msurtani
  Date: 07/01/19 07:05:41

  Modified:    src/org/jboss/cache/marshall   Marshaller.java
                        VersionAwareMarshaller.java
  Log:
  Javadoc enhancements
  
  Revision  Changes    Path
  1.12      +7 -6      JBossCache/src/org/jboss/cache/marshall/Marshaller.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Marshaller.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/marshall/Marshaller.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -b -r1.11 -r1.12
  --- Marshaller.java	17 Jan 2007 17:21:36 -0000	1.11
  +++ Marshaller.java	19 Jan 2007 12:05:41 -0000	1.12
  @@ -13,9 +13,10 @@
    * The reason why this is implemented specially in JBoss Cache rather than resorting to
    * Java serialization or even the more efficient JBoss serialization is that a lot of efficiency
    * can be gained when a majority of the serialization that occurs has to do with a small set
  - * of known types such as {@link org.jboss.cache.Fqn} or {@link MethodCall}.
  + * of known types such as {@link org.jboss.cache.Fqn} or {@link MethodCall}, and class type information
  + * can be replaced with simple magic numbers.
    * <p/>
  - * Unknown types (typically user data} falls back to JBoss serialization.
  + * Unknown types (typically user data) falls back to JBoss serialization.
    * <p/>
    * In addition, using a marshaller allows adding additional data to the byte stream, such as context
    * class loader information on which class loader to use to deserialize the object stream, or versioning
  @@ -33,7 +34,7 @@
   public interface Marshaller extends RpcDispatcher.Marshaller
   {
      /**
  -    * Marshalls an object to a given ObjectOutputStream
  +    * Marshalls an object to a given {@link ObjectOutputStream}
       *
       * @param obj object to marshall
       * @param out stream to marshall to
  @@ -42,7 +43,7 @@
      void objectToObjectStream(Object obj, ObjectOutputStream out) throws Exception;
   
      /**
  -    * Unmarshalls an object from a stream
  +    * Unmarshalls an object from an {@link ObjectInputStream}
       *
       * @param in stream to unmarshall from
       * @throws Exception
  @@ -50,7 +51,7 @@
      Object objectFromObjectStream(ObjectInputStream in) throws Exception;
   
      /**
  -    * Creates an Object from the InputStream passed in
  +    * Unmarshalls an object from an {@link java.io.InputStream}
       *
       * @param is stream to unmarshall from
       * @return Object from stream passed in.
  @@ -59,7 +60,7 @@
      Object objectFromStream(InputStream is) throws Exception;
   
      /**
  -    * Overloaded form of {@link #objectToObjectStream(Object,java.io.ObjectOutputStream)} which adds a hint to the Fqn region
  +    * Overloaded form of {@link #objectToObjectStream(Object,java.io.ObjectOutputStream)} which adds a hint to the {@link Fqn} region
       *
       * @param obj    object to marshall
       * @param region fqn that this object pertains to
  
  
  
  1.17      +4 -35     JBossCache/src/org/jboss/cache/marshall/VersionAwareMarshaller.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: VersionAwareMarshaller.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/marshall/VersionAwareMarshaller.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -b -r1.16 -r1.17
  --- VersionAwareMarshaller.java	17 Jan 2007 17:21:36 -0000	1.16
  +++ VersionAwareMarshaller.java	19 Jan 2007 12:05:41 -0000	1.17
  @@ -21,7 +21,9 @@
   
   /**
    * A delegate to various other marshallers like {@link org.jboss.cache.marshall.CacheMarshaller200}.
  - * This delegating marshaller adds versioning to the stream.
  + * This delegating marshaller adds versioning information to the stream when marshalling objects and
  + * is able to pick the appropriate marshaller to delegate to based on the versioning information when
  + * unmarshalling objects.
    *
    * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
    * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
  @@ -46,7 +48,7 @@
         this.defaultInactive = defaultInactive;
         this.useRegionBasedMarshalling = useRegionBasedMarshalling;
   
  -      // convert the replication version passed in to the MINOR version.
  +      // "Rounds down" the replication version passed in to the MINOR version.
         // E.g., 1.4.1.SP3 -> 1.4.0
   
         versionInt = toMinorVersionInt(version);
  @@ -108,14 +110,6 @@
         }
      }
   
  -   /**
  -    * Marshals the object passed in to a byte buffer using an appropriate {@link AbstractMarshaller} based on
  -    * the version information passed in to this instance upon construction (See {@link #VersionAwareMarshaller(org.jboss.cache.RegionManager,boolean,boolean,String)})
  -    *
  -    * @param obj
  -    * @return a byte stream representing the object passed in.
  -    * @throws Exception
  -    */
      public byte[] objectToByteBuffer(Object obj) throws Exception
      {
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
  @@ -134,14 +128,6 @@
         return bos.toByteArray();
      }
   
  -   /**
  -    * Creates an Object from the byte buffer passed in, using the appropriate {@link AbstractMarshaller} based
  -    * on the version headers in the byte stream.
  -    *
  -    * @param buf
  -    * @return Object from byte buffer passed in.
  -    * @throws Exception
  -    */
      public Object objectFromByteBuffer(byte[] buf) throws Exception
      {
         Marshaller marshaller;
  @@ -149,8 +135,6 @@
         ObjectInputStream in;
         try
         {
  -         // just a peek - does not actually "remove" these bytes from the stream.
  -         // create an input stream and read the first short
            in = ObjectSerializationFactory.createObjectInputStream(buf);
            versionId = in.readShort();
            if (log.isTraceEnabled()) log.trace("Read version " + versionId);
  @@ -173,8 +157,6 @@
         ObjectInputStream in;
         try
         {
  -         // just a peek - does not actually "remove" these bytes from the stream.
  -         // create an input stream and read the first short
            in = ObjectSerializationFactory.createObjectInputStream(is);
            versionId = in.readShort();
            if (log.isTraceEnabled()) log.trace("Read version " + versionId);
  @@ -192,7 +174,6 @@
   
      public void objectToObjectStream(Object obj, ObjectOutputStream out, Fqn region) throws Exception
      {
  -      //defaultMarshaller.objectToObjectStream(obj, out);
         out.writeShort(versionInt);
         if (log.isTraceEnabled()) log.trace("Wrote version " + versionInt);
         defaultMarshaller.objectToObjectStream(obj, out, region);
  @@ -222,21 +203,11 @@
         return marshaller;
      }
   
  -   /**
  -    * Acts as a versioning decorator to the default marshaller.  Does not create or close the stream.
  -    *
  -    * @param obj object to marshall
  -    * @param out output stream (should be created using {@link org.jboss.cache.marshall.ObjectSerializationFactory}
  -    * @throws Exception
  -    */
      public void objectToObjectStream(Object obj, ObjectOutputStream out) throws Exception
      {
  -      //defaultMarshaller.objectToObjectStream(obj, out);
         out.writeShort(versionInt);
         if (log.isTraceEnabled()) log.trace("Wrote version " + versionInt);
  -      //now marshall the contents of the object
         defaultMarshaller.objectToObjectStream(obj, out);
  -//      out.close();
      }
   
      public Object objectFromObjectStream(ObjectInputStream in) throws Exception
  @@ -245,8 +216,6 @@
         int versionId;
         try
         {
  -         // just a peek - does not actually "remove" these bytes from the stream.
  -         // create an input stream and read the first short
            versionId = in.readShort();
            if (log.isTraceEnabled()) log.trace("Read version " + versionId);
         }
  
  
  



More information about the jboss-cvs-commits mailing list