public String getNodeID() { return nodeUUID.toString(); }
private void createNodeId() throws Exception { ByteBuffer id = ByteBuffer.allocateDirect(16); int read = channel.read(id, 3); if (read != 16) { uuid = UUIDGenerator.getInstance().generateUUID(); nodeID = new SimpleString(uuid.toString()); id.put(uuid.asBytes(), 0, 16); id.position(0); channel.write(id, 3); channel.force(true); } else { byte[] bytes = new byte[16]; id.position(0); id.get(bytes); uuid = new UUID(UUID.TYPE_TIME_BASED, bytes); nodeID = new SimpleString(uuid.toString()); } }
/** * Sets the nodeID. * <p/> * Only used by replicating backups. * * @param nodeID */ public void setNodeID(String nodeID) { synchronized (nodeIDGuard) { this.nodeID = new SimpleString(nodeID); this.uuid = new UUID(UUID.TYPE_TIME_BASED, UUID.stringToBytes(nodeID)); } }
private void readNodeId() throws Exception { ByteBuffer id = ByteBuffer.allocateDirect(16); int read = channel.read(id, 3); if (read != 16) { throw new IllegalStateException("live server did not write id to file"); } else { byte[] bytes = new byte[16]; id.position(0); id.get(bytes); uuid = new UUID(UUID.TYPE_TIME_BASED, bytes); nodeID = new SimpleString(uuid.toString()); } }
@Override public final SimpleString readNodeId() throws HornetQIllegalStateException, IOException { ByteBuffer id = ByteBuffer.allocateDirect(16); int read = channel.read(id, 3); if (read != 16) { throw new HornetQIllegalStateException("live server did not write id to file"); } byte[] bytes = new byte[16]; id.position(0); id.get(bytes); setUUID(new UUID(UUID.TYPE_TIME_BASED, bytes)); return getNodeId(); }
/** * @param message * @return */ public static byte[] getDuplicateBytes(final UUID nodeUUID, final long messageID) { byte[] bytes = new byte[24]; ByteBuffer bb = ByteBuffer.wrap(bytes); bb.put(nodeUUID.asBytes()); bb.putLong(messageID); return bytes; }
public final UUID generateTimeBasedUUID(final byte[] byteAddr) { byte[] contents = new byte[16]; int pos = 10; for (int i = 0; i < 6; ++i) { contents[pos + i] = byteAddr[i]; } synchronized (mTimerLock) { if (mTimer == null) { mTimer = new UUIDTimer(getRandomNumberGenerator()); } mTimer.getTimestamp(contents); } return new UUID(UUID.TYPE_TIME_BASED, contents); }
public static final byte[] getDuplicateBytes(final UUID nodeUUID, final long messageID) { byte[] bytes = new byte[24]; ByteBuffer bb = ByteBuffer.wrap(bytes); bb.put(nodeUUID.asBytes()); bb.putLong(messageID); return bytes; }
public String getNodeId() { return nodeUUID.toString(); }
public UUID generateTimeBasedUUID(final byte[] byteAddr) { byte[] contents = new byte[16]; int pos = 10; for (int i = 0; i < 6; ++i) { contents[pos + i] = byteAddr[i]; } synchronized (mTimerLock) { if (mTimer == null) { mTimer = new UUIDTimer(getRandomNumberGenerator()); } mTimer.getTimestamp(contents); } return new UUID(UUID.TYPE_TIME_BASED, contents); }
public void encodeHeadersAndProperties(final HornetQBuffer buffer) { buffer.writeLong(messageID); buffer.writeNullableSimpleString(address); if (userID == null) { buffer.writeByte(DataConstants.NULL); } else { buffer.writeByte(DataConstants.NOT_NULL); buffer.writeBytes(userID.asBytes()); } buffer.writeByte(type); buffer.writeBoolean(durable); buffer.writeLong(expiration); buffer.writeLong(timestamp); buffer.writeByte(priority); properties.encode(buffer); }
/** * @param generateUUID */ protected void setUUID(UUID generateUUID) { synchronized (nodeIDGuard) { uuid = generateUUID; nodeID = new SimpleString(uuid.toString()); } }
public void decodeHeadersAndProperties(final HornetQBuffer buffer) { messageID = buffer.readLong(); address = buffer.readNullableSimpleString(); if (buffer.readByte() == DataConstants.NOT_NULL) { byte[] bytes = new byte[16]; buffer.readBytes(bytes); userID = new UUID(UUID.TYPE_TIME_BASED, bytes); } else { userID = null; } type = buffer.readByte(); durable = buffer.readBoolean(); expiration = buffer.readLong(); timestamp = buffer.readLong(); priority = buffer.readByte(); properties.decode(buffer); }
public void encodeHeadersAndProperties(final HornetQBuffer buffer) { buffer.writeLong(messageID); buffer.writeNullableSimpleString(address); if (userID == null) { buffer.writeByte(DataConstants.NULL); } else { buffer.writeByte(DataConstants.NOT_NULL); buffer.writeBytes(userID.asBytes()); } buffer.writeByte(type); buffer.writeBoolean(durable); buffer.writeLong(expiration); buffer.writeLong(timestamp); buffer.writeByte(priority); properties.encode(buffer); }
public String getJMSMessageID() { if (msgID == null) { UUID uid = message.getUserID(); msgID = uid == null ? null : "ID:" + uid.toString(); } return msgID; }
public void decodeHeadersAndProperties(final HornetQBuffer buffer) { messageID = buffer.readLong(); address = buffer.readNullableSimpleString(); if (buffer.readByte() == DataConstants.NOT_NULL) { byte[] bytes = new byte[16]; buffer.readBytes(bytes); userID = new UUID(UUID.TYPE_TIME_BASED, bytes); } else { userID = null; } type = buffer.readByte(); durable = buffer.readBoolean(); expiration = buffer.readLong(); timestamp = buffer.readLong(); priority = buffer.readByte(); properties.decode(buffer); }
public String generateStringUUID() { byte[] address = getAddressBytes(); if (address == null) { return java.util.UUID.randomUUID().toString(); } else { return generateTimeBasedUUID(address).toString(); } }
public final String generateStringUUID() { byte[] address = getAddressBytes(); if (address == null) { return java.util.UUID.randomUUID().toString(); } else { return generateTimeBasedUUID(address).toString(); } }