Adding timestamp to print-data

This is a simple change to add the timestamp on toString which will appear on 
print-data


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/fbe05083
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/fbe05083
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/fbe05083

Branch: refs/heads/master
Commit: fbe0508350d6ae6d390b9c1287deb031320f67cd
Parents: eb4355a
Author: Clebert Suconic <[email protected]>
Authored: Wed May 27 09:55:14 2015 -0400
Committer: Clebert Suconic <[email protected]>
Committed: Thu May 28 11:20:37 2015 -0400

----------------------------------------------------------------------
 .../artemis/core/server/impl/ServerMessageImpl.java  | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fbe05083/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerMessageImpl.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerMessageImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerMessageImpl.java
index ff14ecf..870e922 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerMessageImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerMessageImpl.java
@@ -319,10 +319,23 @@ public class ServerMessageImpl extends MessageImpl 
implements ServerMessage
    public String toString()
    {
       return "ServerMessage[messageID=" + messageID + ",durable=" + 
isDurable() + ",userID=" + getUserID() + ",priority=" + this.getPriority() + ", 
bodySize=" + this.getBodyBufferCopy().capacity() +
-         ",expiration=" + (this.getExpiration() != 0 ? new 
java.util.Date(this.getExpiration()) : 0) +
+         ", timestamp=" + toDate(getTimestamp()) + ",expiration=" + 
toDate(getExpiration()) +
          ", durable=" + durable + ", address=" + getAddress() + ",properties=" 
+ properties.toString() + "]@" + System.identityHashCode(this);
    }
 
+   private static String toDate(long timestamp)
+   {
+      if (timestamp == 0)
+      {
+         return "0";
+      }
+      else
+      {
+         return new java.util.Date(timestamp).toString();
+      }
+
+   }
+
    public InputStream getBodyInputStream()
    {
       return null;

Reply via email to