[jboss-cvs] JBoss Messaging SVN: r4147 - in trunk/src/main/org/jboss/messaging: core/remoting/impl/codec and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 6 08:46:02 EDT 2008


Author: timfox
Date: 2008-05-06 08:46:02 -0400 (Tue, 06 May 2008)
New Revision: 4147

Added:
   trunk/src/main/org/jboss/messaging/util/DataConstants.java
Modified:
   trunk/src/main/org/jboss/messaging/core/remoting/impl/ConnectorRegistryImpl.java
   trunk/src/main/org/jboss/messaging/core/remoting/impl/codec/ConsumerDeliverMessageCodec.java
   trunk/src/main/org/jboss/messaging/core/remoting/impl/codec/ProducerSendMessageCodec.java
   trunk/src/main/org/jboss/messaging/core/remoting/impl/codec/SessionCreateProducerMessageCodec.java
Log:
Missing file


Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/ConnectorRegistryImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/ConnectorRegistryImpl.java	2008-05-06 11:50:27 UTC (rev 4146)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/ConnectorRegistryImpl.java	2008-05-06 12:46:02 UTC (rev 4147)
@@ -101,21 +101,23 @@
          return connector;
       }
 
+      //TODO INVM optimisation is disabled for now
+      
       // check if the server is in the same vm than the client
-      if (localDispatchers.containsKey(key))
-      {
-         PacketDispatcher localDispatcher = localDispatchers.get(key);
-         NIOConnector connector = new INVMConnector(idCounter.getAndIncrement(), dispatcher, localDispatcher);
+//      if (localDispatchers.containsKey(key))
+//      {
+//         PacketDispatcher localDispatcher = localDispatchers.get(key);
+//         NIOConnector connector = new INVMConnector(idCounter.getAndIncrement(), dispatcher, localDispatcher);
+//
+//         if (log.isDebugEnabled())
+//            log.debug("Created " + connector + " to connect to "
+//                  + key);
+//
+//         NIOConnectorHolder holder = new NIOConnectorHolder(connector);
+//         connectors.put(key, holder);
+//         return connector;
+//      }
 
-         if (log.isDebugEnabled())
-            log.debug("Created " + connector + " to connect to "
-                  + key);
-
-         NIOConnectorHolder holder = new NIOConnectorHolder(connector);
-         connectors.put(key, holder);
-         return connector;
-      }
-
       NIOConnector connector = null;
 
       TransportType transport = location.getTransport();

Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/codec/ConsumerDeliverMessageCodec.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/codec/ConsumerDeliverMessageCodec.java	2008-05-06 11:50:27 UTC (rev 4146)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/codec/ConsumerDeliverMessageCodec.java	2008-05-06 12:46:02 UTC (rev 4147)
@@ -39,12 +39,9 @@
 
    // AbstractPacketCodec overrides ---------------------------------
 
-   //TODO - remove this when in next stage of refactoring
-   private byte[] encodedMsg;
-   
    public int getBodyLength(final ConsumerDeliverMessage packet) throws Exception
    {
-   	encodedMsg = StreamUtils.toBytes(packet.getMessage());
+      byte[] encodedMsg = StreamUtils.toBytes(packet.getMessage());
    	
    	return SIZE_INT + encodedMsg.length + SIZE_LONG; 
    }
@@ -52,6 +49,7 @@
    @Override
    protected void encodeBody(final ConsumerDeliverMessage message, final RemotingBuffer out) throws Exception
    {
+      byte[] encodedMsg = StreamUtils.toBytes(message.getMessage());
       out.putInt(encodedMsg.length);
       out.put(encodedMsg);
       out.putLong(message.getDeliveryID());

Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/codec/ProducerSendMessageCodec.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/codec/ProducerSendMessageCodec.java	2008-05-06 11:50:27 UTC (rev 4146)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/codec/ProducerSendMessageCodec.java	2008-05-06 12:46:02 UTC (rev 4147)
@@ -41,12 +41,9 @@
 
    // AbstractPacketCodec overrides ---------------------------------
    
-   //TOD remove this in next stage of refactoring
-   private byte[] encodedMsg;
-   
    public int getBodyLength(final ProducerSendMessage packet) throws Exception
    {
-   	encodedMsg = StreamUtils.toBytes(packet.getMessage());   
+   	byte[] encodedMsg = StreamUtils.toBytes(packet.getMessage());   
 
       int bodyLength = SimpleString.sizeofNullableString(packet.getAddress()) + SIZE_INT + encodedMsg.length;
       
@@ -56,6 +53,7 @@
    @Override
    protected void encodeBody(final ProducerSendMessage message, final RemotingBuffer out) throws Exception
    {
+      byte[] encodedMsg = StreamUtils.toBytes(message.getMessage());  
       out.putNullableSimpleString(message.getAddress());
       out.putInt(encodedMsg.length);
       out.put(encodedMsg);

Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/codec/SessionCreateProducerMessageCodec.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/codec/SessionCreateProducerMessageCodec.java	2008-05-06 11:50:27 UTC (rev 4146)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/codec/SessionCreateProducerMessageCodec.java	2008-05-06 12:46:02 UTC (rev 4147)
@@ -44,7 +44,7 @@
    {   	
    	SimpleString address = packet.getAddress();
       
-      int bodyLength = SimpleString.sizeofString(address) + 2 * SIZE_INT;
+      int bodyLength = SimpleString.sizeofNullableString(address) + 2 * SIZE_INT;
       
       return bodyLength;
    }
@@ -54,7 +54,7 @@
    {
       SimpleString address = request.getAddress();
      
-      out.putSimpleString(address);
+      out.putNullableSimpleString(address);
       out.putInt(request.getWindowSize());
       out.putInt(request.getMaxRate());
    }
@@ -63,7 +63,7 @@
    protected SessionCreateProducerMessage decodeBody(final RemotingBuffer in)
          throws Exception
    {
-      SimpleString address = in.getSimpleString();
+      SimpleString address = in.getNullableSimpleString();
       
       int windowSize = in.getInt();
       

Added: trunk/src/main/org/jboss/messaging/util/DataConstants.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/DataConstants.java	                        (rev 0)
+++ trunk/src/main/org/jboss/messaging/util/DataConstants.java	2008-05-06 12:46:02 UTC (rev 4147)
@@ -0,0 +1,37 @@
+package org.jboss.messaging.util;
+
+/**
+ * 
+ * A DataConstants
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class DataConstants
+{
+   public static final int SIZE_INT = 4;   
+   public static final int SIZE_BOOLEAN = 1;   
+   public static final int SIZE_LONG = 8;   
+   public static final int SIZE_BYTE = 1;
+   public static final int SIZE_SHORT = 2;
+   public static final int SIZE_DOUBLE = 8;
+   public static final int SIZE_FLOAT = 4;
+   public static final int SIZE_CHAR = 2;
+ 
+   public static final byte TRUE = 1;
+   public static final byte FALSE = 0;
+      
+   public static final byte NULL = 0;   
+   public static final byte NOT_NULL = 1;
+   
+   public static final byte BOOLEAN = 2;	
+   public static final byte BYTE = 3;
+   public static final byte BYTES = 4;
+   public static final byte SHORT = 5;
+   public static final byte INT = 6;
+   public static final byte LONG = 7;
+   public static final byte FLOAT = 8;
+   public static final byte DOUBLE = 9;
+   public static final byte STRING = 10;
+   public static final byte CHAR = 11;      
+}




More information about the jboss-cvs-commits mailing list