@Test public void generatedIdsShouldBeLinearlyIncreasingAcrossTimeSlots() { List<Long> generatedIds = new ArrayList<>(); long started = System.nanoTime(); while (System.nanoTime() - started < 200_000_000L) { generatedIds.add(flake.nextId()); } assertFalse(generatedIds.isEmpty()); assertThatListIsStrictlyOrdered(generatedIds); }
@Override public Long nextId() { final SequenceNumber sequenceNumber = getSequence().nextSequenceNumber(); final ByteBuffer bb = (ByteBuffer) toByteBuffer(sequenceNumber); return encoder.encode(bb); }
Flake64L extends Flake64<Long> { @Override public Long nextId() { final SequenceNumber sequenceNumber = getSequence().nextSequenceNumber(); final ByteBuffer bb = (ByteBuffer) toByteBuffer(sequenceNumber); return encoder.encode(bb); } }
Flake64L extends Flake64<Long> { @Override public Long nextId() { final SequenceNumber sequenceNumber = getSequence().nextSequenceNumber(); final ByteBuffer bb = (ByteBuffer) toByteBuffer(sequenceNumber); return encoder.encode(bb); } Flake64L(final TimeProvider timeProvider,
                    final WorkerIdProvider workerIdProvider);  Flake64L(final TimeProvider timeProvider,
                    final WorkerIdProvider workerIdProvider,
                    final Encoder<ByteBuffer, Long> encoder); }
Flake64L extends Flake64<Long> { @Override public Long nextId() { final SequenceNumber sequenceNumber = getSequence().nextSequenceNumber(); final ByteBuffer bb = (ByteBuffer) toByteBuffer(sequenceNumber); return encoder.encode(bb); } Flake64L(final TimeProvider timeProvider,
                    final WorkerIdProvider workerIdProvider);  Flake64L(final TimeProvider timeProvider,
                    final WorkerIdProvider workerIdProvider,
                    final Encoder<ByteBuffer, Long> encoder); @Override Long nextId(); }
Flake64L extends Flake64<Long> { @Override public Long nextId() { final SequenceNumber sequenceNumber = getSequence().nextSequenceNumber(); final ByteBuffer bb = (ByteBuffer) toByteBuffer(sequenceNumber); return encoder.encode(bb); } Flake64L(final TimeProvider timeProvider,
                    final WorkerIdProvider workerIdProvider);  Flake64L(final TimeProvider timeProvider,
                    final WorkerIdProvider workerIdProvider,
                    final Encoder<ByteBuffer, Long> encoder); @Override Long nextId();  }