activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r383980 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java
Date Tue, 07 Mar 2006 19:48:03 GMT
Author: jstrachan
Date: Tue Mar  7 11:48:02 2006
New Revision: 383980

URL: http://svn.apache.org/viewcvs?rev=383980&view=rev
Log:
added helper methods for NIO/AIO/UDP based transports

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java?rev=383980&r1=383979&r2=383980&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java
Tue Mar  7 11:48:02 2006
@@ -231,6 +231,46 @@
     }
     
     /**
+     * Used by NIO or AIO transports
+     */
+    public int tightMarshal1(Object o, BooleanStream bs) throws IOException {
+        int size=1;
+        if( o != null) {
+            DataStructure c = (DataStructure) o;
+            byte type = c.getDataStructureType();
+            DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[type &
0xFF];
+            if( dsm == null )
+                throw new IOException("Unknown data type: "+type);
+
+            size += dsm.tightMarshal1(this, c, bs);
+            size += bs.marshalledSize(); 
+        }
+        return size;
+    }
+    
+    /**
+     * Used by NIO or AIO transports; note that the size is not written as part of this method.
+     */
+    public void tightMarshal2(Object o, DataOutputStream ds, BooleanStream bs) throws IOException
{
+        if( cacheEnabled ) {
+            runMarshallCacheEvictionSweep();
+        }
+        
+        if( o != null) {
+            DataStructure c = (DataStructure) o;
+            byte type = c.getDataStructureType();
+            DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[type &
0xFF];
+            if( dsm == null )
+                throw new IOException("Unknown data type: "+type);
+
+            ds.writeByte(type);            
+            bs.marshal(ds);
+            dsm.tightMarshal2(this, c, ds, bs);            
+        } 
+    }
+
+    
+    /**
      * Allows you to dynamically switch the version of the openwire protocol being used.
      * @param version
      */



Mime
View raw message