@Test void testGetId() { UniqueId uniqueId = new UniqueId(); assertNotEquals(uniqueId.getId(), uniqueId.getId()); }
public byte[] getId() { if (seq == MAX_SHORT) { throw new RuntimeException("Too fast"); } long time; synchronized (lock) { time = System.currentTimeMillis(); if (time != lastTimestamp) { lastTimestamp = time; seq = 0; } seq++; ByteBuffer bb = ByteBuffer.allocate(16); bb.putLong(time); bb.put(NODE); bb.putShort((short) seq); return bb.array(); } }
UniqueId { public byte[] getId() { if (seq == MAX_SHORT) { throw new RuntimeException("Too fast"); } long time; synchronized (lock) { time = System.currentTimeMillis(); if (time != lastTimestamp) { lastTimestamp = time; seq = 0; } seq++; ByteBuffer bb = ByteBuffer.allocate(16); bb.putLong(time); bb.put(NODE); bb.putShort((short) seq); return bb.array(); } } }
UniqueId { public byte[] getId() { if (seq == MAX_SHORT) { throw new RuntimeException("Too fast"); } long time; synchronized (lock) { time = System.currentTimeMillis(); if (time != lastTimestamp) { lastTimestamp = time; seq = 0; } seq++; ByteBuffer bb = ByteBuffer.allocate(16); bb.putLong(time); bb.put(NODE); bb.putShort((short) seq); return bb.array(); } }  }
UniqueId { public byte[] getId() { if (seq == MAX_SHORT) { throw new RuntimeException("Too fast"); } long time; synchronized (lock) { time = System.currentTimeMillis(); if (time != lastTimestamp) { lastTimestamp = time; seq = 0; } seq++; ByteBuffer bb = ByteBuffer.allocate(16); bb.putLong(time); bb.put(NODE); bb.putShort((short) seq); return bb.array(); } }  byte[] getId(); }
UniqueId { public byte[] getId() { if (seq == MAX_SHORT) { throw new RuntimeException("Too fast"); } long time; synchronized (lock) { time = System.currentTimeMillis(); if (time != lastTimestamp) { lastTimestamp = time; seq = 0; } seq++; ByteBuffer bb = ByteBuffer.allocate(16); bb.putLong(time); bb.put(NODE); bb.putShort((short) seq); return bb.array(); } }  byte[] getId();  }