public class ThreadLocalMonotonicTimestampGenerator extends Object
System.currentTimeMillis()
, with an incrementing thread-local counter
to generate the sub-millisecond part.
This implementation guarantees incrementing timestamps for a given client thread, provided that no more than
1000 are requested for a given clock tick (the exact granularity of of System.currentTimeMillis()
depends on the operating system).
If that rate is exceeded, a warning is logged and the timestamps don't increment anymore until the next clock
tick.Constructor and Description |
---|
ThreadLocalMonotonicTimestampGenerator() |
Modifier and Type | Method and Description |
---|---|
protected long |
computeNext(long last) |
long |
next()
Returns the next timestamp.
|
public ThreadLocalMonotonicTimestampGenerator()
public long next()
TimestampGenerator
Long.MIN_VALUE
, it won't be
sent by the driver, letting Cassandra generate a server-side timestamp.protected long computeNext(long last)