[jboss-cvs] JBoss Messaging SVN: r5935 - trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Feb 26 05:12:22 EST 2009


Author: ataylor
Date: 2009-02-26 05:12:21 -0500 (Thu, 26 Feb 2009)
New Revision: 5935

Modified:
   trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryResponseMessage.java
Log:
added getRequiredBufferSize()

Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryResponseMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryResponseMessage.java	2009-02-26 04:18:19 UTC (rev 5934)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryResponseMessage.java	2009-02-26 10:12:21 UTC (rev 5935)
@@ -27,6 +27,7 @@
 
 import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
 import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.DataConstants;
 
 /**
  * 
@@ -40,7 +41,9 @@
    private boolean exists;
    
    private List<SimpleString> queueNames;
-   
+
+   private static final int BASIC_SIZE = DataConstants.SIZE_BOOLEAN + DataConstants.SIZE_INT;
+
    public SessionBindingQueryResponseMessage(final boolean exists, final List<SimpleString> queueNames)
    {
       super(SESS_BINDINGQUERY_RESP);
@@ -90,7 +93,17 @@
          queueNames.add(buffer.getSimpleString());
       }          
    }
-   
+
+   public int getRequiredBufferSize()
+   {
+      int size = BASIC_PACKET_SIZE + BASIC_SIZE;
+      for (SimpleString queueName : queueNames)
+      {
+         size += queueName.length() + DataConstants.SIZE_INT;
+      }
+      return size; 
+   }
+
    public boolean equals(Object other)
    {
       if (other instanceof SessionBindingQueryResponseMessage == false)




More information about the jboss-cvs-commits mailing list