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

This commit is contained in:
Clebert Suconic 2015-04-01 16:10:17 -04:00
parent 36b83d9b49
commit a7a362b1d7
1 changed files with 36 additions and 2 deletions

View File

@ -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) + "]";
}
}
}
/**