Improve packet toString() to ease debug

This commit is contained in:
jbertram 2016-05-05 08:24:09 -05:00
parent bb9ea989fb
commit 6aaa9df49f
49 changed files with 440 additions and 8 deletions

View File

@ -42,6 +42,14 @@ public class CheckFailoverMessage extends PacketImpl {
nodeID = buffer.readNullableString();
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", nodeID=" + nodeID);
buff.append("]");
return buff.toString();
}
public String getNodeID() {
return nodeID;
}

View File

@ -47,6 +47,14 @@ public class CheckFailoverReplyMessage extends PacketImpl {
okToFailover = buffer.readBoolean();
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", okToFailover=" + okToFailover);
buff.append("]");
return buff.toString();
}
public boolean isOkToFailover() {
return okToFailover;
}

View File

@ -148,6 +148,17 @@ public class ClusterTopologyChangeMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", exit=" + exit);
buff.append(", last=" + last);
buff.append(", nodeID=" + nodeID);
buff.append(", pair=" + pair);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj) {

View File

@ -143,6 +143,19 @@ public class ClusterTopologyChangeMessage_V2 extends ClusterTopologyChangeMessag
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", exit=" + exit);
buff.append(", last=" + last);
buff.append(", nodeID=" + nodeID);
buff.append(", pair=" + pair);
buff.append(", backupGroupName=" + backupGroupName);
buff.append(", uniqueEventID=" + uniqueEventID);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj) {

View File

@ -75,6 +75,20 @@ public class ClusterTopologyChangeMessage_V3 extends ClusterTopologyChangeMessag
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", exit=" + exit);
buff.append(", last=" + last);
buff.append(", nodeID=" + nodeID);
buff.append(", pair=" + pair);
buff.append(", backupGroupName=" + backupGroupName);
buff.append(", uniqueEventID=" + uniqueEventID);
buff.append(", scaleDownGroupName=" + scaleDownGroupName);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj) {

View File

@ -194,6 +194,25 @@ public class CreateSessionMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", autoCommitAcks=" + autoCommitAcks);
buff.append(", autoCommitSends=" + autoCommitSends);
buff.append(", defaultAddress=" + defaultAddress);
buff.append(", minLargeMessageSize=" + minLargeMessageSize);
buff.append(", name=" + name);
buff.append(", password=" + password);
buff.append(", preAcknowledge=" + preAcknowledge);
buff.append(", sessionChannelID=" + sessionChannelID);
buff.append(", username=" + username);
buff.append(", version=" + version);
buff.append(", windowSize=" + windowSize);
buff.append(", xa=" + xa);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -78,4 +78,12 @@ public class CreateSessionResponseMessage extends PacketImpl {
return false;
return true;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", serverVersion=" + serverVersion);
buff.append("]");
return buff.toString();
}
}

View File

@ -58,7 +58,8 @@ public class CreateSharedQueueMessage extends PacketImpl {
buff.append(", address=" + address);
buff.append(", queueName=" + queueName);
buff.append(", filterString=" + filterString);
buff.append(", durable=" + filterString);
buff.append(", durable=" + durable);
buff.append(", requiresResponse=" + requiresResponse);
buff.append("]");
return buff.toString();
}

View File

@ -42,6 +42,14 @@ public class DisconnectConsumerMessage extends PacketImpl {
consumerId = buffer.readLong();
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", consumerId=" + consumerId);
buff.append("]");
return buff.toString();
}
public long getConsumerId() {
return consumerId;
}

View File

@ -36,9 +36,8 @@ public abstract class MessagePacket extends PacketImpl implements MessagePacketI
}
@Override
public String toString() {
return this.getParentString() + ",message=" + message + "]";
public String getParentString() {
return super.getParentString() + ", message=" + message;
}

View File

@ -71,6 +71,15 @@ public class ReattachSessionMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", lastConfirmedCommandID=" + lastConfirmedCommandID);
buff.append(", name=" + name);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -78,6 +78,15 @@ public class ReattachSessionResponseMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", lastConfirmedCommandID=" + lastConfirmedCommandID);
buff.append(", reattached=" + reattached);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -65,6 +65,14 @@ public class RollbackMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", considerLastMessageAsDelivered=" + considerLastMessageAsDelivered);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -83,6 +83,16 @@ public class SessionAcknowledgeMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", consumerID=" + consumerID);
buff.append(", messageID=" + messageID);
buff.append(", requiresResponse=" + requiresResponse);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -73,6 +73,15 @@ public class SessionAddMetaDataMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", key=" + key);
buff.append(", data=" + data);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -97,6 +97,16 @@ public class SessionAddMetaDataMessageV2 extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", key=" + key);
buff.append(", data=" + data);
buff.append(", requiresConfirmation=" + requiresConfirmation);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -56,6 +56,14 @@ public class SessionBindingQueryMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", address=" + address);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -89,6 +89,15 @@ public class SessionBindingQueryResponseMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", exists=" + exists);
buff.append(", queueNames=" + queueNames);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -65,6 +65,16 @@ public class SessionBindingQueryResponseMessage_V2 extends SessionBindingQueryRe
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", exists=" + exists);
buff.append(", queueNames=" + queueNames);
buff.append(", autoCreateJmsQueues=" + autoCreateJmsQueues);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -86,6 +86,15 @@ public abstract class SessionContinuationMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", body=" + Arrays.toString(body));
buff.append(", continues=" + continues);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -55,6 +55,9 @@ public class SessionCreateConsumerMessage extends PacketImpl {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", queueName=" + queueName);
buff.append(", filterString=" + filterString);
buff.append(", id=" + id);
buff.append(", browseOnly=" + browseOnly);
buff.append(", requiresResponse=" + requiresResponse);
buff.append("]");
return buff.toString();
}

View File

@ -77,6 +77,15 @@ public class SessionExpireMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", consumerID=" + consumerID);
buff.append(", messageID=" + messageID);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -92,6 +92,16 @@ public class SessionIndividualAcknowledgeMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", consumerID=" + consumerID);
buff.append(", messageID=" + messageID);
buff.append(", requiresResponse=" + requiresResponse);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -67,6 +67,15 @@ public class SessionProducerCreditsFailMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", address=" + address);
buff.append(", credits=" + credits);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -67,6 +67,15 @@ public class SessionProducerCreditsMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", address=" + address);
buff.append(", credits=" + credits);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -56,6 +56,14 @@ public class SessionQueueQueryMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", queueName=" + queueName);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -156,6 +156,21 @@ public class SessionQueueQueryResponseMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", address=" + address);
buff.append(", name=" + name);
buff.append(", consumerCount=" + consumerCount);
buff.append(", filterString=" + filterString);
buff.append(", durable=" + durable);
buff.append(", exists=" + exists);
buff.append(", temporary=" + temporary);
buff.append(", messageCount=" + messageCount);
buff.append("]");
return buff.toString();
}
public ClientSession.QueueQuery toQueueQuery() {
return new QueueQueryImpl(isDurable(), isTemporary(), getConsumerCount(), getMessageCount(), getFilterString(), getAddress(), getName(), isExists());
}

View File

@ -88,6 +88,22 @@ public class SessionQueueQueryResponseMessage_V2 extends SessionQueueQueryRespon
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", address=" + address);
buff.append(", name=" + name);
buff.append(", consumerCount=" + consumerCount);
buff.append(", filterString=" + filterString);
buff.append(", durable=" + durable);
buff.append(", exists=" + exists);
buff.append(", temporary=" + temporary);
buff.append(", messageCount=" + messageCount);
buff.append(", autoCreationEnabled=" + autoCreationEnabled);
buff.append("]");
return buff.toString();
}
@Override
public ClientSession.QueueQuery toQueueQuery() {
return new QueueQueryImpl(isDurable(), isTemporary(), getConsumerCount(), getMessageCount(), getFilterString(), getAddress(), getName(), isExists(), isAutoCreationEnabled());

View File

@ -100,6 +100,14 @@ public class SessionReceiveContinuationMessage extends SessionContinuationMessag
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", consumerID=" + consumerID);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -108,6 +108,17 @@ public class SessionReceiveLargeMessage extends PacketImpl implements MessagePac
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", consumerID=" + consumerID);
buff.append(", deliveryCount=" + deliveryCount);
buff.append(", largeMessageSize=" + largeMessageSize);
buff.append(", message=" + message);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -109,6 +109,15 @@ public class SessionReceiveMessage extends MessagePacket {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", consumerID=" + consumerID);
buff.append(", deliveryCount=" + deliveryCount);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -74,6 +74,15 @@ public class SessionRequestProducerCreditsMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", credits=" + credits);
buff.append(", address=" + address);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -16,6 +16,8 @@
*/
package org.apache.activemq.artemis.core.protocol.core.impl.wireformat;
import java.util.Arrays;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.api.core.client.SendAcknowledgementHandler;
import org.apache.activemq.artemis.core.message.impl.MessageInternal;
@ -119,6 +121,18 @@ public class SessionSendContinuationMessage extends SessionContinuationMessage {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", body=" + Arrays.toString(body));
buff.append(", continues=" + continues);
buff.append(", message=" + message);
buff.append(", messageBodySize=" + messageBodySize);
buff.append(", requiresResponse=" + requiresResponse);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -67,6 +67,14 @@ public class SessionSendLargeMessage extends PacketImpl implements MessagePacket
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", largeMessage=" + largeMessage);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -118,6 +118,14 @@ public class SessionSendMessage extends MessagePacket {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", requiresResponse=" + requiresResponse);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -70,6 +70,14 @@ public class SessionXAAfterFailedMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", xid=" + xid);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -58,6 +58,14 @@ public class SessionXAForgetMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", xid=" + xid);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -68,6 +68,14 @@ public class SessionXAGetInDoubtXidsResponseMessage extends PacketImpl {
}
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", xids=" + xids);
buff.append("]");
return buff.toString();
}
@Override
public int hashCode() {
final int prime = 31;

View File

@ -60,6 +60,14 @@ public class SessionXAGetTimeoutResponseMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", timeoutSeconds=" + timeoutSeconds);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -58,6 +58,14 @@ public class SessionXAJoinMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", xid=" + xid);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -58,6 +58,14 @@ public class SessionXAPrepareMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", xid=" + xid);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -84,6 +84,16 @@ public class SessionXAResponseMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", error=" + error);
buff.append(", message=" + message);
buff.append(", responseCode=" + responseCode);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -60,6 +60,14 @@ public class SessionXAResumeMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", xid=" + xid);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -60,6 +60,14 @@ public class SessionXARollbackMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", xid=" + xid);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -57,6 +57,14 @@ public class SessionXASetTimeoutMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", timeoutSeconds=" + timeoutSeconds);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -62,6 +62,14 @@ public class SessionXASetTimeoutResponseMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", ok=" + ok);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -67,6 +67,14 @@ public class SessionXAStartMessage extends PacketImpl {
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", xid=" + xid);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)

View File

@ -61,10 +61,10 @@ public class SubscribeClusterTopologyUpdatesMessage extends PacketImpl {
@Override
public String toString() {
return "SubscribeClusterTopologyUpdatesMessage [clusterConnection=" + clusterConnection +
", toString()=" +
super.toString() +
"]";
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", clusterConnection=" + clusterConnection);
buff.append("]");
return buff.toString();
}
@Override

View File

@ -61,6 +61,14 @@ public class SubscribeClusterTopologyUpdatesMessageV2 extends SubscribeClusterTo
return result;
}
@Override
public String toString() {
StringBuffer buff = new StringBuffer(getParentString());
buff.append(", clientVersion=" + clientVersion);
buff.append("]");
return buff.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)