[jboss-cvs] JBoss Messaging SVN: r6166 - in trunk/src/main/org/jboss/messaging: core/remoting/impl/wireformat/replication and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Mar 25 15:50:13 EDT 2009
Author: clebert.suconic at jboss.com
Date: 2009-03-25 15:50:12 -0400 (Wed, 25 Mar 2009)
New Revision: 6166
Modified:
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateQueueMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionResponseMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/MessagingExceptionMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/NullResponseMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketsConfirmedMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/Ping.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/Pong.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReattachSessionMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReattachSessionResponseMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReplicateCreateSessionMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/RollbackMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionAcknowledgeMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryResponseMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCloseMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionConsumerCloseMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionConsumerFlowCreditMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateConsumerMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionDeleteQueueMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionExpiredMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionFailoverCompleteMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryResponseMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXACommitMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAEndMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAForgetMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAGetTimeoutResponseMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAJoinMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAPrepareMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAResponseMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAResumeMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXARollbackMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXASetTimeoutMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXASetTimeoutResponseMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAStartMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateAcknowledgeMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateRemoteBindingAddedMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateRemoteBindingRemovedMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateRemoteConsumerAddedMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateRemoteConsumerRemovedMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateStartupInfoMessage.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/SessionReplicateDeliveryMessage.java
trunk/src/main/org/jboss/messaging/utils/SimpleString.java
Log:
Adding getRequiredSize on all the packets
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateQueueMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateQueueMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateQueueMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -23,6 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
import org.jboss.messaging.utils.SimpleString;
/**
@@ -144,6 +145,18 @@
r.temporary == this.temporary;
}
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.Packet#getRequiredBufferSize()
+ */
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + address.sizeof() +
+ queueName.sizeof() +
+ SimpleString.sizeofNullableString(filterString) +
+ DataConstants.SIZE_BOOLEAN +
+ DataConstants.SIZE_BOOLEAN;
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,11 +18,12 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -35,64 +36,70 @@
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
-
+
private String name;
-
+
private long sessionChannelID;
-
+
private int version;
-
+
private String username;
-
+
private String password;
-
+
private int minLargeMessageSize;
-
+
private boolean xa;
-
+
private boolean autoCommitSends;
-
+
private boolean autoCommitAcks;
private boolean preAcknowledge;
-
+
private int windowSize;
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
- public CreateSessionMessage(final String name, final long sessionChannelID,
- final int version, final String username, final String password,
- final int minLargeMessageSize,
- final boolean xa, final boolean autoCommitSends,
- final boolean autoCommitAcks, final boolean preAcknowledge, final int windowSize)
+ public CreateSessionMessage(final String name,
+ final long sessionChannelID,
+ final int version,
+ final String username,
+ final String password,
+ final int minLargeMessageSize,
+ final boolean xa,
+ final boolean autoCommitSends,
+ final boolean autoCommitAcks,
+ final boolean preAcknowledge,
+ final int windowSize)
{
super(CREATESESSION);
-
+
this.name = name;
-
+
this.sessionChannelID = sessionChannelID;
-
+
this.version = version;
this.username = username;
-
+
this.password = password;
-
+
this.minLargeMessageSize = minLargeMessageSize;
-
+
this.xa = xa;
-
+
this.autoCommitSends = autoCommitSends;
-
+
this.autoCommitAcks = autoCommitAcks;
-
+
this.windowSize = windowSize;
this.preAcknowledge = preAcknowledge;
}
-
+
public CreateSessionMessage()
{
super(CREATESESSION);
@@ -104,27 +111,27 @@
{
return name;
}
-
+
public long getSessionChannelID()
- {
+ {
return sessionChannelID;
}
-
+
public int getVersion()
{
return version;
}
-
+
public String getUsername()
{
return username;
}
-
+
public String getPassword()
{
return password;
}
-
+
public boolean isXA()
{
return xa;
@@ -132,12 +139,12 @@
public boolean isAutoCommitSends()
{
- return this.autoCommitSends;
+ return autoCommitSends;
}
-
+
public boolean isAutoCommitAcks()
{
- return this.autoCommitAcks;
+ return autoCommitAcks;
}
public boolean isPreAcknowledge()
@@ -147,9 +154,27 @@
public int getWindowSize()
{
- return this.windowSize;
+ return windowSize;
}
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE +
+ stringEncodeSize(name) + // buffer.writeString(name);
+ DataConstants.SIZE_LONG + // buffer.writeLong(sessionChannelID);
+ DataConstants.SIZE_INT + // buffer.writeInt(version);
+ nullableStringEncodeSize(username) + // buffer.writeNullableString(username);
+ nullableStringEncodeSize(password) + // buffer.writeNullableString(password);
+ DataConstants.SIZE_INT + // buffer.writeInt(minLargeMessageSize);
+ DataConstants.SIZE_BOOLEAN + // buffer.writeBoolean(xa);
+ DataConstants.SIZE_BOOLEAN + // buffer.writeBoolean(autoCommitSends);
+ DataConstants.SIZE_BOOLEAN + // buffer.writeBoolean(autoCommitAcks);
+ DataConstants.SIZE_INT + // buffer.writeInt(windowSize);
+ DataConstants.SIZE_BOOLEAN; // buffer.writeBoolean(preAcknowledge);
+
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeString(name);
@@ -164,7 +189,8 @@
buffer.writeInt(windowSize);
buffer.writeBoolean(preAcknowledge);
}
-
+
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
name = buffer.readString();
@@ -179,29 +205,30 @@
windowSize = buffer.readInt();
preAcknowledge = buffer.readBoolean();
}
-
- public boolean equals(Object other)
+
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof CreateSessionMessage == false)
{
return false;
}
-
+
CreateSessionMessage r = (CreateSessionMessage)other;
-
- boolean matches = super.equals(other) &&
- this.name.equals(r.name) &&
- this.sessionChannelID == r.sessionChannelID &&
- this.version == r.version &&
- this.xa == r.xa &&
- this.autoCommitSends == r.autoCommitSends &&
- this.autoCommitAcks == r.autoCommitAcks &&
- (this.username == null ? r.username == null : this.username.equals(r.username)) &&
- (this.password == null ? r.password == null : this.password.equals(r.password));
-
+
+ boolean matches = super.equals(other) && name.equals(r.name) &&
+ sessionChannelID == r.sessionChannelID &&
+ version == r.version &&
+ xa == r.xa &&
+ autoCommitSends == r.autoCommitSends &&
+ autoCommitAcks == r.autoCommitAcks &&
+ (username == null ? r.username == null : username.equals(r.username)) &&
+ (password == null ? r.password == null : password.equals(r.password));
+
return matches;
}
-
+
+ @Override
public final boolean isRequiresConfirmations()
{
return false;
@@ -214,7 +241,7 @@
{
return minLargeMessageSize;
}
-
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionResponseMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionResponseMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateSessionResponseMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,11 +18,12 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -37,7 +38,7 @@
// Attributes ----------------------------------------------------
private int serverVersion;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -48,49 +49,58 @@
this.serverVersion = serverVersion;
}
-
+
public CreateSessionResponseMessage()
{
super(CREATESESSION_RESP);
}
// Public --------------------------------------------------------
-
+
+ @Override
public boolean isResponse()
{
return true;
}
-
+
public int getServerVersion()
{
return serverVersion;
}
-
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.writeInt(serverVersion);
+ buffer.writeInt(serverVersion);
}
-
+
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
serverVersion = buffer.readInt();
}
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + DataConstants.SIZE_INT;
+ }
- public boolean equals(Object other)
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof CreateSessionResponseMessage == false)
{
return false;
}
-
+
CreateSessionResponseMessage r = (CreateSessionResponseMessage)other;
-
- boolean matches = super.equals(other) &&
- this.serverVersion == r.serverVersion;
-
+
+ boolean matches = super.equals(other) && serverVersion == r.serverVersion;
+
return matches;
}
-
+
+ @Override
public final boolean isRequiresConfirmations()
{
return false;
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/MessagingExceptionMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/MessagingExceptionMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/MessagingExceptionMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -24,6 +24,7 @@
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
@@ -67,7 +68,13 @@
{
return exception;
}
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + DataConstants.SIZE_INT + nullableStringEncodeSize(exception.getMessage());
+ }
+
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeInt(exception.getCode());
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/NullResponseMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/NullResponseMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/NullResponseMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -40,6 +40,16 @@
return true;
}
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.core.remoting.Packet#getRequiredBufferSize()
+ */
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE;
+ }
+
+
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketImpl.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -27,8 +27,6 @@
// Constants -------------------------------------------------------------------------
private static final Logger log = Logger.getLogger(PacketImpl.class);
-
- public static final int DEFAULT_PACKET_SIZE = 1024;
// The minimal size for all the packets, Common data for all the packets (look at PacketImpl.encode)
protected static final int BASIC_PACKET_SIZE = DataConstants.SIZE_INT + DataConstants.SIZE_BYTE + DataConstants.SIZE_LONG;
@@ -220,7 +218,7 @@
public int getRequiredBufferSize()
{
- return DEFAULT_PACKET_SIZE;
+ return BASIC_PACKET_SIZE;
}
public boolean isResponse()
@@ -274,6 +272,15 @@
// Protected -----------------------------------------------------
+ protected int stringEncodeSize(String str)
+ {
+ return DataConstants.SIZE_INT + str.length() * 2;
+ }
+
+ protected int nullableStringEncodeSize(String str)
+ {
+ return DataConstants.SIZE_BOOLEAN + (str != null ? stringEncodeSize(str) : 0);
+ }
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketsConfirmedMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketsConfirmedMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/PacketsConfirmedMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -23,6 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
/**
*
@@ -62,6 +63,11 @@
return this.commandID;
}
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + DataConstants.SIZE_INT;
+ }
+
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeInt(commandID);
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/Ping.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/Ping.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/Ping.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -23,6 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
/**
*
@@ -62,6 +63,12 @@
return expirePeriod;
}
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + DataConstants.SIZE_LONG;
+ }
+
+
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeLong(expirePeriod);
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/Pong.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/Pong.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/Pong.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -23,6 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
/**
*
@@ -68,6 +69,12 @@
return newPeriod;
}
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + DataConstants.SIZE_LONG;
+ }
+
+
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeLong(newPeriod);
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReattachSessionMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReattachSessionMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReattachSessionMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -23,6 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
/**
*
@@ -71,6 +72,12 @@
return lastReceivedCommandID;
}
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + stringEncodeSize(name) + DataConstants.SIZE_INT;
+ }
+
+
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeString(name);
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReattachSessionResponseMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReattachSessionResponseMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReattachSessionResponseMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -23,6 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
/**
*
@@ -72,6 +73,12 @@
return removed;
}
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + DataConstants.SIZE_INT + DataConstants.SIZE_BOOLEAN;
+ }
+
+
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeInt(lastReceivedCommandID);
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReplicateCreateSessionMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReplicateCreateSessionMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/ReplicateCreateSessionMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -23,6 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -153,12 +154,12 @@
public boolean isAutoCommitSends()
{
- return this.autoCommitSends;
+ return autoCommitSends;
}
public boolean isAutoCommitAcks()
{
- return this.autoCommitAcks;
+ return autoCommitAcks;
}
public boolean isPreAcknowledge()
@@ -168,9 +169,27 @@
public int getWindowSize()
{
- return this.windowSize;
+ return windowSize;
}
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE +
+ stringEncodeSize(name) + // buffer.writeString(name);
+ DataConstants.SIZE_LONG + // buffer.writeLong(originalSessionChannelID);
+ DataConstants.SIZE_LONG + // buffer.writeLong(replicatedSessionChannelID);
+ DataConstants.SIZE_INT + // buffer.writeInt(version);
+ nullableStringEncodeSize(username) + // buffer.writeNullableString(username);
+ nullableStringEncodeSize(password) + // buffer.writeNullableString(password);
+ DataConstants.SIZE_INT + // buffer.writeInt(minLargeMessageSize);
+ DataConstants.SIZE_BOOLEAN + // buffer.writeBoolean(xa);
+ DataConstants.SIZE_BOOLEAN + // buffer.writeBoolean(autoCommitSends);
+ DataConstants.SIZE_BOOLEAN + // buffer.writeBoolean(autoCommitAcks);
+ DataConstants.SIZE_INT + // buffer.writeInt(windowSize);
+ DataConstants.SIZE_BOOLEAN; // buffer.writeBoolean(preAcknowledge);
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeString(name);
@@ -187,6 +206,7 @@
buffer.writeBoolean(preAcknowledge);
}
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
name = buffer.readString();
@@ -203,7 +223,8 @@
preAcknowledge = buffer.readBoolean();
}
- public boolean equals(Object other)
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof ReplicateCreateSessionMessage == false)
{
@@ -212,21 +233,22 @@
ReplicateCreateSessionMessage r = (ReplicateCreateSessionMessage)other;
- boolean matches = super.equals(other) && this.name.equals(r.name) &&
- this.originalSessionChannelID == r.originalSessionChannelID &&
- this.replicatedSessionChannelID == r.replicatedSessionChannelID &&
- this.version == r.version &&
- this.xa == r.xa &&
- this.autoCommitSends == r.autoCommitSends &&
- this.autoCommitAcks == r.autoCommitAcks &&
- (this.username == null ? r.username == null : this.username.equals(r.username)) &&
- (this.password == null ? r.password == null : this.password.equals(r.password)) &&
- this.minLargeMessageSize == r.minLargeMessageSize &&
- this.windowSize == r.windowSize;
+ boolean matches = super.equals(other) && name.equals(r.name) &&
+ originalSessionChannelID == r.originalSessionChannelID &&
+ replicatedSessionChannelID == r.replicatedSessionChannelID &&
+ version == r.version &&
+ xa == r.xa &&
+ autoCommitSends == r.autoCommitSends &&
+ autoCommitAcks == r.autoCommitAcks &&
+ (username == null ? r.username == null : username.equals(r.username)) &&
+ (password == null ? r.password == null : password.equals(r.password)) &&
+ minLargeMessageSize == r.minLargeMessageSize &&
+ windowSize == r.windowSize;
return matches;
}
+ @Override
public final boolean isRequiresConfirmations()
{
return false;
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/RollbackMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/RollbackMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/RollbackMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -48,7 +48,7 @@
public RollbackMessage(final boolean considerLastMessageAsDelivered)
{
super(SESS_ROLLBACK);
-
+
this.considerLastMessageAsDelivered = considerLastMessageAsDelivered;
}
@@ -71,9 +71,14 @@
*/
public void setConsiderLastMessageAsDelivered(final boolean isLastMessageAsDelived)
{
- this.considerLastMessageAsDelivered = isLastMessageAsDelived;
+ considerLastMessageAsDelivered = isLastMessageAsDelived;
}
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + DataConstants.SIZE_BOOLEAN;
+ }
+
@Override
public void encodeBody(final MessagingBuffer buffer)
{
@@ -83,7 +88,7 @@
@Override
public void decodeBody(final MessagingBuffer buffer)
{
- this.considerLastMessageAsDelivered = buffer.readBoolean();
+ considerLastMessageAsDelivered = buffer.readBoolean();
}
// Static --------------------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionAcknowledgeMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionAcknowledgeMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionAcknowledgeMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -13,6 +13,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -29,7 +30,7 @@
private long messageID;
private boolean requiresResponse;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -67,6 +68,12 @@
return requiresResponse;
}
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + DataConstants.SIZE_LONG + DataConstants.SIZE_LONG + DataConstants.SIZE_BOOLEAN;
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeLong(consumerID);
@@ -76,6 +83,7 @@
buffer.writeBoolean(requiresResponse);
}
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
consumerID = buffer.readLong();
@@ -85,7 +93,8 @@
requiresResponse = buffer.readBoolean();
}
- public boolean equals(Object other)
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof SessionAcknowledgeMessage == false)
{
@@ -94,9 +103,9 @@
SessionAcknowledgeMessage r = (SessionAcknowledgeMessage)other;
- return super.equals(other) && this.consumerID == r.consumerID &&
- this.messageID == r.messageID &&
- this.requiresResponse == r.requiresResponse;
+ return super.equals(other) && consumerID == r.consumerID &&
+ messageID == r.messageID &&
+ requiresResponse == r.requiresResponse;
}
// Package protected ---------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,14 +18,13 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
import org.jboss.messaging.utils.SimpleString;
-
/**
*
* A SessionQueueQueryMessage
@@ -41,39 +40,47 @@
{
super(SESS_BINDINGQUERY);
- this.address = address;
+ this.address = address;
}
-
+
public SessionBindingQueryMessage()
{
- super(SESS_BINDINGQUERY);
+ super(SESS_BINDINGQUERY);
}
public SimpleString getAddress()
{
return address;
}
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + address.sizeof();
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeSimpleString(address);
}
-
+
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
address = buffer.readSimpleString();
}
-
- public boolean equals(Object other)
+
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof SessionBindingQueryMessage == false)
{
return false;
}
-
+
SessionBindingQueryMessage r = (SessionBindingQueryMessage)other;
-
- return super.equals(other) && this.address.equals(r.address);
+
+ return super.equals(other) && address.equals(r.address);
}
-
+
}
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-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionBindingQueryResponseMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,7 +18,7 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
@@ -26,8 +26,8 @@
import java.util.List;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
import org.jboss.messaging.utils.SimpleString;
-import org.jboss.messaging.utils.DataConstants;
/**
*
@@ -39,11 +39,9 @@
public class SessionBindingQueryResponseMessage extends PacketImpl
{
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);
@@ -52,12 +50,13 @@
this.queueNames = queueNames;
}
-
+
public SessionBindingQueryResponseMessage()
{
super(SESS_BINDINGQUERY_RESP);
}
-
+
+ @Override
public boolean isResponse()
{
return true;
@@ -70,56 +69,59 @@
public List<SimpleString> getQueueNames()
{
- return this.queueNames;
+ return queueNames;
}
-
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeBoolean(exists);
- buffer.writeInt(queueNames.size());
- for (SimpleString queueName: queueNames)
+ buffer.writeInt(queueNames.size());
+ for (SimpleString queueName : queueNames)
{
buffer.writeSimpleString(queueName);
- }
+ }
}
-
+
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
- exists = buffer.readBoolean();
- int numQueues = buffer.readInt();
- queueNames = new ArrayList<SimpleString>(numQueues);
+ exists = buffer.readBoolean();
+ int numQueues = buffer.readInt();
+ queueNames = new ArrayList<SimpleString>(numQueues);
for (int i = 0; i < numQueues; i++)
{
queueNames.add(buffer.readSimpleString());
- }
+ }
}
public int getRequiredBufferSize()
{
- int size = BASIC_PACKET_SIZE + BASIC_SIZE;
+ int size = BASIC_PACKET_SIZE + DataConstants.SIZE_BOOLEAN + DataConstants.SIZE_INT;
for (SimpleString queueName : queueNames)
{
- size += queueName.length() * 2 + DataConstants.SIZE_INT;
+ size += queueName.sizeof();
}
- return size;
+ return size;
}
- public boolean equals(Object other)
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof SessionBindingQueryResponseMessage == false)
{
return false;
}
-
+
SessionBindingQueryResponseMessage r = (SessionBindingQueryResponseMessage)other;
-
- if (super.equals(other) && this.exists == r.exists)
+
+ if (super.equals(other) && exists == r.exists)
{
- if (this.queueNames.size() == r.queueNames.size())
+ if (queueNames.size() == r.queueNames.size())
{
for (int i = 0; i < queueNames.size(); i++)
{
- if (!this.queueNames.get(i).equals(r.queueNames.get(i)))
+ if (!queueNames.get(i).equals(r.queueNames.get(i)))
{
return false;
}
@@ -134,8 +136,8 @@
{
return false;
}
-
+
return true;
}
-
+
}
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCloseMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCloseMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCloseMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -12,7 +12,6 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @version <tt>$Revision$</tt>
@@ -33,7 +32,12 @@
}
// Public --------------------------------------------------------
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE;
+ }
+
@Override
public boolean equals(final Object other)
{
@@ -42,11 +46,9 @@
return false;
}
- SessionCloseMessage r = (SessionCloseMessage)other;
+ return super.equals(other);
+ }
- return super.equals(other);
- }
-
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionConsumerCloseMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionConsumerCloseMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionConsumerCloseMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,11 +18,12 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -36,7 +37,7 @@
// Attributes ----------------------------------------------------
private long consumerID;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -45,9 +46,9 @@
{
super(SESS_CONSUMER_CLOSE);
- this.consumerID = objectID;
+ consumerID = objectID;
}
-
+
public SessionConsumerCloseMessage()
{
super(SESS_CONSUMER_CLOSE);
@@ -59,33 +60,41 @@
{
return consumerID;
}
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + DataConstants.SIZE_LONG;
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeLong(consumerID);
}
-
+
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
consumerID = buffer.readLong();
}
-
+
@Override
public String toString()
{
return getParentString() + ", consumerID=" + consumerID + "]";
}
-
- public boolean equals(Object other)
+
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof SessionConsumerCloseMessage == false)
{
return false;
}
-
+
SessionConsumerCloseMessage r = (SessionConsumerCloseMessage)other;
-
- return super.equals(other) && this.consumerID == r.consumerID;
+
+ return super.equals(other) && consumerID == r.consumerID;
}
// Package protected ---------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionConsumerFlowCreditMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionConsumerFlowCreditMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionConsumerFlowCreditMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,11 +18,12 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -37,9 +38,9 @@
// Attributes ----------------------------------------------------
private long consumerID;
-
+
private int credits;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -49,10 +50,10 @@
super(SESS_FLOWTOKEN);
this.consumerID = consumerID;
-
+
this.credits = credits;
}
-
+
public SessionConsumerFlowCreditMessage()
{
super(SESS_FLOWTOKEN);
@@ -64,18 +65,25 @@
{
return consumerID;
}
-
+
public int getCredits()
{
return credits;
}
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + DataConstants.SIZE_LONG + DataConstants.SIZE_INT;
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeLong(consumerID);
buffer.writeInt(credits);
}
-
+
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
consumerID = buffer.readLong();
@@ -87,18 +95,18 @@
{
return getParentString() + ", consumerID=" + consumerID + ", credits=" + credits + "]";
}
-
- public boolean equals(Object other)
+
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof SessionConsumerFlowCreditMessage == false)
{
return false;
}
-
+
SessionConsumerFlowCreditMessage r = (SessionConsumerFlowCreditMessage)other;
-
- return super.equals(other) && this.credits == r.credits
- && this.consumerID == r.consumerID;
+
+ return super.equals(other) && credits == r.credits && consumerID == r.consumerID;
}
// Package protected ---------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateConsumerMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateConsumerMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionCreateConsumerMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,14 +18,14 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
import org.jboss.messaging.utils.SimpleString;
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
*
@@ -43,13 +43,13 @@
private boolean browseOnly;
-
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
- public SessionCreateConsumerMessage(final SimpleString queueName, final SimpleString filterString,
- final boolean browseOnly)
+ public SessionCreateConsumerMessage(final SimpleString queueName,
+ final SimpleString filterString,
+ final boolean browseOnly)
{
super(SESS_CREATECONSUMER);
@@ -90,6 +90,14 @@
return browseOnly;
}
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + queueName.sizeof() +
+ SimpleString.sizeofNullableString(filterString) +
+ DataConstants.SIZE_BOOLEAN;
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeSimpleString(queueName);
@@ -97,6 +105,7 @@
buffer.writeBoolean(browseOnly);
}
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
queueName = buffer.readSimpleString();
@@ -104,20 +113,20 @@
browseOnly = buffer.readBoolean();
}
- public boolean equals(Object other)
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof SessionCreateConsumerMessage == false)
{
return false;
}
-
+
SessionCreateConsumerMessage r = (SessionCreateConsumerMessage)other;
-
- return super.equals(other) &&
- this.queueName.equals(r.queueName) &&
- this.filterString == null ? r.filterString == null : this.filterString.equals(r.filterString);
+
+ return super.equals(other) && queueName.equals(r.queueName) && filterString == null ? r.filterString == null
+ : filterString.equals(r.filterString);
}
-
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionDeleteQueueMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionDeleteQueueMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionDeleteQueueMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,11 +18,12 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
import org.jboss.messaging.utils.SimpleString;
/**
@@ -37,7 +38,7 @@
// Attributes ----------------------------------------------------
private SimpleString queueName;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -48,7 +49,7 @@
this.queueName = queueName;
}
-
+
public SessionDeleteQueueMessage()
{
super(DELETE_QUEUE);
@@ -64,17 +65,22 @@
buff.append("]");
return buff.toString();
}
-
+
public SimpleString getQueueName()
{
return queueName;
}
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + queueName.sizeof();
+ }
+
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeSimpleString(queueName);
}
-
+
public void decodeBody(final MessagingBuffer buffer)
{
queueName = buffer.readSimpleString();
@@ -86,9 +92,9 @@
{
return false;
}
-
+
SessionDeleteQueueMessage r = (SessionDeleteQueueMessage)other;
-
+
return super.equals(other) && r.queueName.equals(this.queueName);
}
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionExpiredMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionExpiredMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionExpiredMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -13,6 +13,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -58,6 +59,12 @@
return messageID;
}
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + DataConstants.SIZE_LONG + DataConstants.SIZE_LONG;
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeLong(consumerID);
@@ -65,6 +72,7 @@
buffer.writeLong(messageID);
}
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
consumerID = buffer.readLong();
@@ -72,7 +80,8 @@
messageID = buffer.readLong();
}
- public boolean equals(Object other)
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof SessionExpiredMessage == false)
{
@@ -81,7 +90,7 @@
SessionExpiredMessage r = (SessionExpiredMessage)other;
- return super.equals(other) && this.consumerID == r.consumerID && this.messageID == r.messageID;
+ return super.equals(other) && consumerID == r.consumerID && messageID == r.messageID;
}
// Package protected ---------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionFailoverCompleteMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionFailoverCompleteMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionFailoverCompleteMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,7 +18,7 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
@@ -38,7 +38,7 @@
// Attributes ----------------------------------------------------
private String name;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -49,7 +49,7 @@
this.name = name;
}
-
+
public SessionFailoverCompleteMessage()
{
super(SESS_FAILOVER_COMPLETE);
@@ -61,34 +61,43 @@
{
return name;
}
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + stringEncodeSize(name);
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeString(name);
}
-
+
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
name = buffer.readString();
}
-
+
+ @Override
public boolean isRequiresConfirmations()
{
return false;
}
- public boolean equals(Object other)
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof SessionFailoverCompleteMessage == false)
{
return false;
}
-
+
SessionFailoverCompleteMessage r = (SessionFailoverCompleteMessage)other;
-
- return super.equals(other) && this.name.equals(r.name);
+
+ return super.equals(other) && name.equals(r.name);
}
-
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
@@ -97,4 +106,3 @@
// Inner classes -------------------------------------------------
}
-
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -53,7 +53,13 @@
{
return queueName;
}
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + queueName.sizeof();
+ }
+
+
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeSimpleString(queueName);
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryResponseMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryResponseMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionQueueQueryResponseMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -23,6 +23,7 @@
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
import org.jboss.messaging.utils.SimpleString;
/**
@@ -116,7 +117,19 @@
{
return address;
}
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE +
+ DataConstants.SIZE_BOOLEAN + // buffer.writeBoolean(exists);
+ DataConstants.SIZE_BOOLEAN + // buffer.writeBoolean(durable);
+ DataConstants.SIZE_INT + // buffer.writeInt(consumerCount);
+ DataConstants.SIZE_INT + // buffer.writeInt(messageCount);
+ SimpleString.sizeofNullableString(filterString) + // buffer.writeNullableSimpleString(filterString);
+ SimpleString.sizeofNullableString(address); // buffer.writeNullableSimpleString(address);
+ }
+
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeBoolean(exists);
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionSendMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -218,7 +218,6 @@
}
}
- @Override
public int getRequiredBufferSize()
{
int size;
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXACommitMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXACommitMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXACommitMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,15 +18,15 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
import javax.transaction.xa.Xid;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
*
@@ -37,11 +37,11 @@
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
-
+
private boolean onePhase;
-
+
private Xid xid;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -49,34 +49,41 @@
public SessionXACommitMessage(final Xid xid, final boolean onePhase)
{
super(SESS_XA_COMMIT);
-
+
this.xid = xid;
this.onePhase = onePhase;
}
-
+
public SessionXACommitMessage()
{
super(SESS_XA_COMMIT);
}
// Public --------------------------------------------------------
-
+
public Xid getXid()
{
return xid;
}
-
+
public boolean isOnePhase()
{
return onePhase;
}
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + XidCodecSupport.getXidEncodeLength(xid) + DataConstants.SIZE_BOOLEAN;
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
XidCodecSupport.encodeXid(xid, buffer);
buffer.writeBoolean(onePhase);
}
-
+
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
xid = XidCodecSupport.decodeXid(buffer);
@@ -88,20 +95,20 @@
{
return getParentString() + ", xid=" + xid + ", onePhase=" + onePhase + "]";
}
-
- public boolean equals(Object other)
+
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof SessionXACommitMessage == false)
{
return false;
}
-
+
SessionXACommitMessage r = (SessionXACommitMessage)other;
-
- return super.equals(other) && this.xid.equals(r.xid) &&
- this.onePhase == r.onePhase;
+
+ return super.equals(other) && xid.equals(r.xid) && onePhase == r.onePhase;
}
-
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
@@ -110,4 +117,3 @@
// Inner classes -------------------------------------------------
}
-
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAEndMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAEndMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAEndMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -25,6 +25,7 @@
import javax.transaction.xa.Xid;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
/**
@@ -71,7 +72,12 @@
{
return xid;
}
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + XidCodecSupport.getXidEncodeLength(xid) + DataConstants.SIZE_BOOLEAN;
+ }
+
public void encodeBody(final MessagingBuffer buffer)
{
XidCodecSupport.encodeXid(xid, buffer);
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAForgetMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAForgetMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAForgetMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -25,6 +25,7 @@
import javax.transaction.xa.Xid;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
/**
@@ -62,7 +63,12 @@
{
return xid;
}
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + XidCodecSupport.getXidEncodeLength(xid);
+ }
+
public void encodeBody(final MessagingBuffer buffer)
{
XidCodecSupport.encodeXid(xid, buffer);
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,7 +18,7 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
@@ -28,8 +28,8 @@
import javax.transaction.xa.Xid;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
*
@@ -40,9 +40,9 @@
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
-
+
private List<Xid> xids;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -50,61 +50,75 @@
public SessionXAGetInDoubtXidsResponseMessage(final List<Xid> xids)
{
super(SESS_XA_INDOUBT_XIDS_RESP);
-
+
this.xids = xids;
}
-
+
public SessionXAGetInDoubtXidsResponseMessage()
{
super(SESS_XA_INDOUBT_XIDS_RESP);
}
// Public --------------------------------------------------------
-
+
+ @Override
public boolean isResponse()
{
return true;
}
-
+
public List<Xid> getXids()
{
return xids;
}
+ public int getRequiredBufferSize()
+ {
+ int size = BASIC_PACKET_SIZE + DataConstants.SIZE_INT;
+ for (Xid xid : xids)
+ {
+ size += XidCodecSupport.getXidEncodeLength(xid);
+ }
+ return size;
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeInt(xids.size());
- for (Xid xid: xids)
+ for (Xid xid : xids)
{
XidCodecSupport.encodeXid(xid, buffer);
- }
+ }
}
-
+
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
int len = buffer.readInt();
- xids = new ArrayList<Xid>(len);
+ xids = new ArrayList<Xid>(len);
for (int i = 0; i < len; i++)
{
Xid xid = XidCodecSupport.decodeXid(buffer);
-
+
xids.add(xid);
- }
+ }
}
-
- public boolean equals(Object other)
+
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof SessionXAGetInDoubtXidsResponseMessage == false)
{
return false;
}
-
+
SessionXAGetInDoubtXidsResponseMessage r = (SessionXAGetInDoubtXidsResponseMessage)other;
-
+
if (super.equals(other))
{
- if (this.xids.size() == r.xids.size())
+ if (xids.size() == r.xids.size())
{
for (int i = 0; i < xids.size(); i++)
{
@@ -121,7 +135,7 @@
}
return true;
}
-
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
@@ -130,5 +144,3 @@
// Inner classes -------------------------------------------------
}
-
-
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAGetTimeoutResponseMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAGetTimeoutResponseMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAGetTimeoutResponseMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,14 +18,13 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
-
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
*
@@ -36,9 +35,9 @@
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
-
+
private int timeoutSeconds;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -46,47 +45,52 @@
public SessionXAGetTimeoutResponseMessage(final int timeoutSeconds)
{
super(SESS_XA_GET_TIMEOUT_RESP);
-
+
this.timeoutSeconds = timeoutSeconds;
}
-
+
public SessionXAGetTimeoutResponseMessage()
{
super(SESS_XA_GET_TIMEOUT_RESP);
}
-
+
// Public --------------------------------------------------------
-
+
public boolean isResponse()
{
return true;
}
-
+
public int getTimeoutSeconds()
{
return this.timeoutSeconds;
}
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + DataConstants.SIZE_INT;
+ }
+
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.writeInt(timeoutSeconds);
+ buffer.writeInt(timeoutSeconds);
}
-
+
public void decodeBody(final MessagingBuffer buffer)
{
- timeoutSeconds = buffer.readInt();
+ timeoutSeconds = buffer.readInt();
}
-
+
public boolean equals(Object other)
{
if (other instanceof SessionXAGetTimeoutResponseMessage == false)
{
return false;
}
-
+
SessionXAGetTimeoutResponseMessage r = (SessionXAGetTimeoutResponseMessage)other;
-
- return super.equals(other) && this.timeoutSeconds == r.timeoutSeconds;
+
+ return super.equals(other) && this.timeoutSeconds == r.timeoutSeconds;
}
// Package protected ---------------------------------------------
@@ -97,4 +101,3 @@
// Inner classes -------------------------------------------------
}
-
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAJoinMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAJoinMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAJoinMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -25,6 +25,7 @@
import javax.transaction.xa.Xid;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
/**
@@ -62,7 +63,12 @@
{
return xid;
}
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + XidCodecSupport.getXidEncodeLength(xid);
+ }
+
public void encodeBody(final MessagingBuffer buffer)
{
XidCodecSupport.encodeXid(xid, buffer);
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAPrepareMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAPrepareMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAPrepareMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,15 +18,15 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
import javax.transaction.xa.Xid;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
*
@@ -37,9 +37,9 @@
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
-
+
private Xid xid;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -47,41 +47,46 @@
public SessionXAPrepareMessage(final Xid xid)
{
super(SESS_XA_PREPARE);
-
+
this.xid = xid;
}
-
+
public SessionXAPrepareMessage()
{
super(SESS_XA_PREPARE);
}
// Public --------------------------------------------------------
-
+
public Xid getXid()
{
return xid;
}
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + XidCodecSupport.getXidEncodeLength(xid);
+ }
+
public void encodeBody(final MessagingBuffer buffer)
{
XidCodecSupport.encodeXid(xid, buffer);
}
-
+
public void decodeBody(final MessagingBuffer buffer)
{
xid = XidCodecSupport.decodeXid(buffer);
}
-
+
public boolean equals(Object other)
{
if (other instanceof SessionXAPrepareMessage == false)
{
return false;
}
-
+
SessionXAPrepareMessage r = (SessionXAPrepareMessage)other;
-
+
return super.equals(other) && this.xid.equals(r.xid);
}
@@ -93,4 +98,3 @@
// Inner classes -------------------------------------------------
}
-
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAResponseMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAResponseMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAResponseMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,13 +18,13 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
*
@@ -35,13 +35,13 @@
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
-
+
private boolean error;
-
+
private int responseCode;
-
+
private String message;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -49,14 +49,14 @@
public SessionXAResponseMessage(final boolean isError, final int responseCode, final String message)
{
super(SESS_XA_RESP);
-
- this.error = isError;
-
+
+ error = isError;
+
this.responseCode = responseCode;
-
+
this.message = message;
}
-
+
public SessionXAResponseMessage()
{
super(SESS_XA_RESP);
@@ -64,51 +64,61 @@
// Public --------------------------------------------------------
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + DataConstants.SIZE_BOOLEAN +
+ DataConstants.SIZE_INT +
+ nullableStringEncodeSize(message);
+ }
+
+ @Override
public boolean isResponse()
{
return true;
}
-
+
public boolean isError()
{
return error;
}
-
+
public int getResponseCode()
{
- return this.responseCode;
+ return responseCode;
}
-
+
public String getMessage()
{
return message;
}
-
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
- buffer.writeBoolean(error);
- buffer.writeInt(responseCode);
+ buffer.writeBoolean(error);
+ buffer.writeInt(responseCode);
buffer.writeNullableString(message);
}
-
+
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
- error = buffer.readBoolean();
- responseCode = buffer.readInt();
+ error = buffer.readBoolean();
+ responseCode = buffer.readInt();
message = buffer.readNullableString();
}
-
- public boolean equals(Object other)
+
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof SessionXAResponseMessage == false)
{
return false;
}
-
+
SessionXAResponseMessage r = (SessionXAResponseMessage)other;
-
- return super.equals(other) && this.error == r.error && this.responseCode == r.responseCode &&
- this.message.equals(r.message);
+
+ return super.equals(other) && error == r.error && responseCode == r.responseCode && message.equals(r.message);
}
// Package protected ---------------------------------------------
@@ -119,4 +129,3 @@
// Inner classes -------------------------------------------------
}
-
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAResumeMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAResumeMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAResumeMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,7 +18,7 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
@@ -26,7 +26,6 @@
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
*
@@ -37,9 +36,9 @@
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
-
+
private Xid xid;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -47,44 +46,52 @@
public SessionXAResumeMessage(final Xid xid)
{
super(SESS_XA_RESUME);
-
+
this.xid = xid;
}
-
+
public SessionXAResumeMessage()
{
super(SESS_XA_RESUME);
}
// Public --------------------------------------------------------
-
+
public Xid getXid()
{
return xid;
}
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + XidCodecSupport.getXidEncodeLength(xid);
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
XidCodecSupport.encodeXid(xid, buffer);
}
-
+
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
xid = XidCodecSupport.decodeXid(buffer);
}
-
- public boolean equals(Object other)
+
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof SessionXAResumeMessage == false)
{
return false;
}
-
+
SessionXAResumeMessage r = (SessionXAResumeMessage)other;
-
- return super.equals(other) && this.xid.equals(r.xid);
+
+ return super.equals(other) && xid.equals(r.xid);
}
-
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
@@ -93,4 +100,3 @@
// Inner classes -------------------------------------------------
}
-
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXARollbackMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXARollbackMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXARollbackMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,7 +18,7 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
@@ -26,7 +26,6 @@
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
*
@@ -37,9 +36,9 @@
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
-
+
private Xid xid;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -47,44 +46,52 @@
public SessionXARollbackMessage(final Xid xid)
{
super(SESS_XA_ROLLBACK);
-
+
this.xid = xid;
}
-
+
public SessionXARollbackMessage()
{
super(SESS_XA_ROLLBACK);
}
// Public --------------------------------------------------------
-
+
public Xid getXid()
{
return xid;
}
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + XidCodecSupport.getXidEncodeLength(xid);
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
XidCodecSupport.encodeXid(xid, buffer);
}
-
+
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
xid = XidCodecSupport.decodeXid(buffer);
}
-
- public boolean equals(Object other)
+
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof SessionXARollbackMessage == false)
{
return false;
}
-
+
SessionXARollbackMessage r = (SessionXARollbackMessage)other;
-
- return super.equals(other) && this.xid.equals(r.xid);
+
+ return super.equals(other) && xid.equals(r.xid);
}
-
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
@@ -93,4 +100,3 @@
// Inner classes -------------------------------------------------
}
-
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXASetTimeoutMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXASetTimeoutMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXASetTimeoutMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,14 +18,13 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
-
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
*
@@ -36,9 +35,9 @@
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
-
+
private int timeoutSeconds;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -46,42 +45,50 @@
public SessionXASetTimeoutMessage(final int timeoutSeconds)
{
super(SESS_XA_SET_TIMEOUT);
-
+
this.timeoutSeconds = timeoutSeconds;
}
-
+
public SessionXASetTimeoutMessage()
{
super(SESS_XA_SET_TIMEOUT);
}
-
+
// Public --------------------------------------------------------
-
+
public int getTimeoutSeconds()
{
- return this.timeoutSeconds;
+ return timeoutSeconds;
}
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + DataConstants.SIZE_INT;
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeInt(timeoutSeconds);
}
-
+
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
timeoutSeconds = buffer.readInt();
}
-
- public boolean equals(Object other)
+
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof SessionXASetTimeoutMessage == false)
{
return false;
}
-
+
SessionXASetTimeoutMessage r = (SessionXASetTimeoutMessage)other;
-
- return super.equals(other) && this.timeoutSeconds == r.timeoutSeconds;
+
+ return super.equals(other) && timeoutSeconds == r.timeoutSeconds;
}
// Package protected ---------------------------------------------
@@ -92,4 +99,3 @@
// Inner classes -------------------------------------------------
}
-
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXASetTimeoutResponseMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXASetTimeoutResponseMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXASetTimeoutResponseMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,13 +18,13 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
*
@@ -35,9 +35,9 @@
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
-
+
private boolean ok;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -45,49 +45,58 @@
public SessionXASetTimeoutResponseMessage(final boolean ok)
{
super(SESS_XA_SET_TIMEOUT_RESP);
-
+
this.ok = ok;
}
-
+
public SessionXASetTimeoutResponseMessage()
{
super(SESS_XA_SET_TIMEOUT_RESP);
}
-
+
// Public --------------------------------------------------------
-
+
+ @Override
public boolean isResponse()
{
return true;
}
-
+
public boolean isOK()
{
return ok;
}
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + DataConstants.SIZE_BOOLEAN;
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeBoolean(ok);
}
-
+
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
ok = buffer.readBoolean();
}
-
- public boolean equals(Object other)
+
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof SessionXASetTimeoutResponseMessage == false)
{
return false;
}
-
+
SessionXASetTimeoutResponseMessage r = (SessionXASetTimeoutResponseMessage)other;
-
- return super.equals(other) && this.ok == r.ok;
+
+ return super.equals(other) && ok == r.ok;
}
-
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAStartMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAStartMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/SessionXAStartMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -18,7 +18,7 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.jboss.messaging.core.remoting.impl.wireformat;
@@ -26,7 +26,6 @@
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
*
@@ -37,9 +36,9 @@
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
-
+
private Xid xid;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -47,42 +46,50 @@
public SessionXAStartMessage(final Xid xid)
{
super(SESS_XA_START);
-
+
this.xid = xid;
}
-
+
public SessionXAStartMessage()
{
super(SESS_XA_START);
}
// Public --------------------------------------------------------
-
+
public Xid getXid()
{
return xid;
}
-
+
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + XidCodecSupport.getXidEncodeLength(xid);
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
XidCodecSupport.encodeXid(xid, buffer);
}
-
+
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
xid = XidCodecSupport.decodeXid(buffer);
}
-
- public boolean equals(Object other)
+
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof SessionXAStartMessage == false)
{
return false;
}
-
+
SessionXAStartMessage r = (SessionXAStartMessage)other;
-
- return super.equals(other) && this.xid.equals(r.xid);
+
+ return super.equals(other) && xid.equals(r.xid);
}
// Package protected ---------------------------------------------
@@ -93,4 +100,3 @@
// Inner classes -------------------------------------------------
}
-
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateAcknowledgeMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateAcknowledgeMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateAcknowledgeMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -14,6 +14,7 @@
import org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
import org.jboss.messaging.utils.SimpleString;
/**
@@ -31,10 +32,10 @@
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
-
- //TODO - use queue id not name for smaller packet size
+
+ // TODO - use queue id not name for smaller packet size
private SimpleString uniqueName;
-
+
private long messageID;
// Static --------------------------------------------------------
@@ -46,7 +47,7 @@
super(REPLICATE_ACKNOWLEDGE);
this.uniqueName = uniqueName;
-
+
this.messageID = messageID;
}
@@ -57,12 +58,19 @@
super(REPLICATE_ACKNOWLEDGE);
}
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + uniqueName.sizeof() + DataConstants.SIZE_LONG;
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeSimpleString(uniqueName);
buffer.writeLong(messageID);
}
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
uniqueName = buffer.readSimpleString();
@@ -73,7 +81,7 @@
{
return uniqueName;
}
-
+
public long getMessageID()
{
return messageID;
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateRemoteBindingAddedMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateRemoteBindingAddedMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateRemoteBindingAddedMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -14,6 +14,7 @@
import org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
import org.jboss.messaging.utils.SimpleString;
/**
@@ -33,11 +34,11 @@
// Attributes ----------------------------------------------------
private SimpleString clusterConnectionName;
-
+
private SimpleString address;
private SimpleString uniqueName;
-
+
private SimpleString routingName;
private int remoteQueueID;
@@ -52,14 +53,14 @@
// Constructors --------------------------------------------------
- public ReplicateRemoteBindingAddedMessage(SimpleString clusterConnectionName,
- SimpleString address,
- SimpleString uniqueName,
- SimpleString routingName,
- int remoteQueueID,
- SimpleString filterString,
- SimpleString sfQueueName,
- int distance)
+ public ReplicateRemoteBindingAddedMessage(final SimpleString clusterConnectionName,
+ final SimpleString address,
+ final SimpleString uniqueName,
+ final SimpleString routingName,
+ final int remoteQueueID,
+ final SimpleString filterString,
+ final SimpleString sfQueueName,
+ final int distance)
{
super(REPLICATE_ADD_REMOTE_QUEUE_BINDING);
@@ -80,6 +81,20 @@
super(REPLICATE_ADD_REMOTE_QUEUE_BINDING);
}
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE +
+ clusterConnectionName.sizeof() + // buffer.writeSimpleString(clusterConnectionName);
+ address.sizeof() + // buffer.writeSimpleString(address);
+ uniqueName.sizeof() + // buffer.writeSimpleString(uniqueName);
+ routingName.sizeof() + // buffer.writeSimpleString(routingName);
+ DataConstants.SIZE_INT + // buffer.writeInt(remoteQueueID);
+ SimpleString.sizeofNullableString(filterString) + // buffer.writeNullableSimpleString(filterString);
+ sfQueueName.sizeof() + // buffer.writeSimpleString(sfQueueName);
+ DataConstants.SIZE_INT; // buffer.writeInt(distance);
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeSimpleString(clusterConnectionName);
@@ -92,6 +107,7 @@
buffer.writeInt(distance);
}
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
clusterConnectionName = buffer.readSimpleString();
@@ -103,7 +119,7 @@
sfQueueName = buffer.readSimpleString();
distance = buffer.readInt();
}
-
+
public SimpleString getClusterConnectionName()
{
return clusterConnectionName;
@@ -118,7 +134,7 @@
{
return uniqueName;
}
-
+
public SimpleString getRoutingName()
{
return routingName;
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateRemoteBindingRemovedMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateRemoteBindingRemovedMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateRemoteBindingRemovedMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -31,14 +31,14 @@
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
-
+
private SimpleString uniqueName;
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
- public ReplicateRemoteBindingRemovedMessage(SimpleString uniqueName)
+ public ReplicateRemoteBindingRemovedMessage(final SimpleString uniqueName)
{
super(REPLICATE_REMOVE_REMOTE_QUEUE_BINDING);
@@ -52,11 +52,18 @@
super(REPLICATE_REMOVE_REMOTE_QUEUE_BINDING);
}
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + uniqueName.sizeof();
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeSimpleString(uniqueName);
}
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
uniqueName = buffer.readSimpleString();
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateRemoteConsumerAddedMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateRemoteConsumerAddedMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateRemoteConsumerAddedMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -34,23 +34,25 @@
// Attributes ----------------------------------------------------
private SimpleString uniqueBindingName;
-
+
private SimpleString filterString;
-
+
private TypedProperties properties;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
- public ReplicateRemoteConsumerAddedMessage(SimpleString uniqueBindingName, SimpleString filterString, TypedProperties properties)
+ public ReplicateRemoteConsumerAddedMessage(final SimpleString uniqueBindingName,
+ final SimpleString filterString,
+ final TypedProperties properties)
{
super(REPLICATE_ADD_REMOTE_CONSUMER);
this.uniqueBindingName = uniqueBindingName;
-
+
this.filterString = filterString;
-
+
this.properties = properties;
}
@@ -61,23 +63,33 @@
super(REPLICATE_ADD_REMOTE_CONSUMER);
}
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE +
+ uniqueBindingName.sizeof() + // buffer.writeSimpleString(uniqueBindingName);
+ SimpleString.sizeofNullableString(filterString) + // buffer.writeNullableSimpleString(filterString);
+ properties.getEncodeSize(); // properties.encode(buffer);
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeSimpleString(uniqueBindingName);
-
+
buffer.writeNullableSimpleString(filterString);
-
+
properties.encode(buffer);
}
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
uniqueBindingName = buffer.readSimpleString();
-
+
filterString = buffer.readNullableSimpleString();
-
+
properties = new TypedProperties();
-
+
properties.decode(buffer);
}
@@ -85,12 +97,12 @@
{
return uniqueBindingName;
}
-
+
public SimpleString getFilterString()
{
return filterString;
}
-
+
public TypedProperties getProperties()
{
return properties;
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateRemoteConsumerRemovedMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateRemoteConsumerRemovedMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateRemoteConsumerRemovedMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -61,6 +61,14 @@
super(REPLICATE_REMOVE_REMOTE_CONSUMER);
}
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE +
+ uniqueBindingName.sizeof() + // buffer.writeSimpleString(uniqueBindingName);
+ SimpleString.sizeofNullableString(filterString) + // buffer.writeNullableSimpleString(filterString);
+ properties.getEncodeSize(); // properties.encode(buffer);
+ }
+
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeSimpleString(uniqueBindingName);
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateStartupInfoMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateStartupInfoMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/ReplicateStartupInfoMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -12,12 +12,11 @@
package org.jboss.messaging.core.remoting.impl.wireformat.replication;
-
import static org.jboss.messaging.utils.UUID.TYPE_TIME_BASED;
import org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
-import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.DataConstants;
import org.jboss.messaging.utils.UUID;
/**
@@ -35,9 +34,9 @@
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
-
+
private UUID nodeID;
-
+
private long currentMessageID;
// Static --------------------------------------------------------
@@ -49,7 +48,7 @@
super(REPLICATE_STARTUP_INFO);
this.nodeID = nodeID;
-
+
this.currentMessageID = currentMessageID;
}
@@ -60,12 +59,21 @@
super(REPLICATE_STARTUP_INFO);
}
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE +
+ nodeID.asBytes().length + // buffer.writeBytes(nodeID.asBytes());
+ DataConstants.SIZE_LONG; // buffer.writeLong(currentMessageID);
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeBytes(nodeID.asBytes());
buffer.writeLong(currentMessageID);
}
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
byte[] bytes = new byte[16];
@@ -78,7 +86,7 @@
{
return nodeID;
}
-
+
public long getCurrentMessageID()
{
return currentMessageID;
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/SessionReplicateDeliveryMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/SessionReplicateDeliveryMessage.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/replication/SessionReplicateDeliveryMessage.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -14,6 +14,7 @@
import org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.utils.DataConstants;
/**
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -59,6 +60,12 @@
return messageID;
}
+ public int getRequiredBufferSize()
+ {
+ return BASIC_PACKET_SIZE + DataConstants.SIZE_LONG + DataConstants.SIZE_LONG;
+ }
+
+ @Override
public void encodeBody(final MessagingBuffer buffer)
{
buffer.writeLong(consumerID);
@@ -66,19 +73,22 @@
buffer.writeLong(messageID);
}
+ @Override
public void decodeBody(final MessagingBuffer buffer)
{
consumerID = buffer.readLong();
messageID = buffer.readLong();
}
-
+
+ @Override
public boolean isRequiresConfirmations()
- {
+ {
return false;
}
- public boolean equals(Object other)
+ @Override
+ public boolean equals(final Object other)
{
if (other instanceof SessionReplicateDeliveryMessage == false)
{
@@ -87,9 +97,9 @@
SessionReplicateDeliveryMessage r = (SessionReplicateDeliveryMessage)other;
- return super.equals(other) && this.consumerID == r.consumerID && this.messageID == r.messageID;
+ return super.equals(other) && consumerID == r.consumerID && messageID == r.messageID;
}
-
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/utils/SimpleString.java
===================================================================
--- trunk/src/main/org/jboss/messaging/utils/SimpleString.java 2009-03-25 16:28:10 UTC (rev 6165)
+++ trunk/src/main/org/jboss/messaging/utils/SimpleString.java 2009-03-25 19:50:12 UTC (rev 6166)
@@ -314,9 +314,14 @@
return new SimpleString(bytes);
}
+ public int sizeof()
+ {
+ return SIZE_INT + data.length;
+ }
+
public static int sizeofString(final SimpleString str)
{
- return SIZE_INT + str.data.length;
+ return str.sizeof();
}
public static int sizeofNullableString(final SimpleString str)
@@ -327,7 +332,7 @@
}
else
{
- return 1 + sizeofString(str);
+ return 1 + str.sizeof();
}
}
More information about the jboss-cvs-commits
mailing list