diff --git a/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java b/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java index dd5b5dd629..830cc85a60 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/ActiveMQMessage.java @@ -50,6 +50,7 @@ public class ActiveMQMessage extends Message implements javax.jms.Message { } transient protected Callback acknowledgeCallback; + transient int hashCode; public Message copy() { ActiveMQMessage copy = new ActiveMQMessage(); @@ -64,7 +65,13 @@ public class ActiveMQMessage extends Message implements javax.jms.Message { } public int hashCode() { - return this.getMessageId().hashCode(); + MessageId id = getMessageId(); + if (id != null) { + return id.hashCode(); + } + else { + return super.hashCode(); + } } public boolean equals(Object o) {