Class DefaultTimestampStrategy

  • All Implemented Interfaces:
    TimestampStrategy

    public final class DefaultTimestampStrategy
    extends Object
    implements TimestampStrategy
    Strategy that provides the current timestamp. This is an implementation of TimestampStrategy that provides millisecond resolution. The timestamp resolution is simulated by adding the next value of an accumulator that is calculated at every call to the method TimestampStrategy.getTimestamp(). The accumulator's range is from 0 to 9,999, that is, the number of 100-nanosecond intervals per millisecond. The accumulator is initialized with a random number between 0 and 255 to void duplicates in the case of multiple time-based generators running in parallel. ### RFC-4122 - 4.2.1.2. System Clock Resolution (P1) The timestamp is generated from the system time, whose resolution may be less than the resolution of the UUID timestamp. (P2) If UUIDs do not need to be frequently generated, the timestamp can simply be the system time multiplied by the number of 100-nanosecond intervals per system time interval. (P3) If a system overruns the generator by requesting too many UUIDs within a single system time interval, the UUID service MUST either return an error, or stall the UUID generator until the system clock catches up. (P4) A high resolution timestamp can be simulated by keeping a COUNT of the number of UUIDs that have been generated with the same value of the system time, and using it to construct the low order bits of the timestamp. The COUNT will range between zero and the number of 100-nanosecond intervals per system time interval. (P5) Note: If the processors overrun the UUID generation frequently, additional node identifiers can be allocated to the system, which will permit higher speed allocation by making multiple UUIDs potentially available for each time stamp value.
    • Constructor Detail

      • DefaultTimestampStrategy

        public DefaultTimestampStrategy()