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(); }
/** * 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 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()); } }
id.position(0); id.get(bytes); setUUID(new UUID(UUID.TYPE_TIME_BASED, bytes));
UUID uuid = new UUID(UUID.TYPE_TIME_BASED, bytesUUID);
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 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 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 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); }