Repository: activemq-6
Updated Branches:
  refs/heads/master 36b83d9b4 -> f8a25d4f7


Improving Print-data on DuplicateIDs (showing some information to help Bridge 
Duplicate IDs)


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

Branch: refs/heads/master
Commit: a7a362b1d71819b6ed2eb3f5cfb241a8a1bc1376
Parents: 36b83d9
Author: Clebert Suconic <[email protected]>
Authored: Wed Apr 1 16:10:17 2015 -0400
Committer: Clebert Suconic <[email protected]>
Committed: Wed Apr 1 16:10:17 2015 -0400

----------------------------------------------------------------------
 .../impl/journal/JournalStorageManager.java     | 38 ++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a7a362b1/activemq-server/src/main/java/org/apache/activemq/core/persistence/impl/journal/JournalStorageManager.java
----------------------------------------------------------------------
diff --git 
a/activemq-server/src/main/java/org/apache/activemq/core/persistence/impl/journal/JournalStorageManager.java
 
b/activemq-server/src/main/java/org/apache/activemq/core/persistence/impl/journal/JournalStorageManager.java
index 1e86bf9..07599fe 100644
--- 
a/activemq-server/src/main/java/org/apache/activemq/core/persistence/impl/journal/JournalStorageManager.java
+++ 
b/activemq-server/src/main/java/org/apache/activemq/core/persistence/impl/journal/JournalStorageManager.java
@@ -115,6 +115,7 @@ import org.apache.activemq.utils.ByteUtil;
 import org.apache.activemq.utils.DataConstants;
 import org.apache.activemq.utils.ExecutorFactory;
 import org.apache.activemq.utils.ActiveMQThreadFactory;
+import org.apache.activemq.utils.UUID;
 import org.apache.activemq.utils.XidCodecSupport;
 
 import static 
org.apache.activemq.core.persistence.impl.journal.JournalRecordIds.ACKNOWLEDGE_CURSOR;
@@ -3489,9 +3490,42 @@ public class JournalStorageManager implements 
StorageManager
          // SimpleString simpleStr = new SimpleString(duplID);
          // return "DuplicateIDEncoding [address=" + address + ", duplID=" + 
simpleStr + "]";
 
-         return "DuplicateIDEncoding [address=" + address + ", duplID=" + 
ByteUtil.bytesToHex(duplID, 2) + "]";
-      }
+         String bridgeRepresentation = null;
+
+         // The bridge will generate IDs on these terms:
+         // This will make them easier to read
+         if (address.toString().startsWith("BRIDGE") && duplID.length == 24)
+         {
+            try
+            {
+               ByteBuffer buff = ByteBuffer.wrap(duplID);
 
+               // 16 for UUID
+               byte[] bytesUUID = new byte[16];
+
+               buff.get(bytesUUID);
+
+               UUID uuid = new UUID(UUID.TYPE_TIME_BASED, bytesUUID);
+
+               long id = buff.getLong();
+               bridgeRepresentation = "nodeUUID=" + uuid.toString() + " 
messageID=" + id;
+            }
+            catch (Throwable ignored)
+            {
+               bridgeRepresentation = null;
+            }
+         }
+
+         if (bridgeRepresentation != null)
+         {
+            return "DuplicateIDEncoding [address=" + address + ", duplID=" + 
ByteUtil.bytesToHex(duplID, 2) + " / " +
+               bridgeRepresentation + "]";
+         }
+         else
+         {
+            return "DuplicateIDEncoding [address=" + address + ", duplID=" + 
ByteUtil.bytesToHex(duplID, 2) + "]";
+         }
+      }
    }
 
    /**

Reply via email to