Watchmaker Framework API
(Version 0.6.2)

org.uncommons.util.id
Class LongSequenceIDSource

java.lang.Object
  extended by org.uncommons.util.id.LongSequenceIDSource
All Implemented Interfaces:
IDSource<Long>

public final class LongSequenceIDSource
extends Object
implements IDSource<Long>

Thread-safe source for unique IDs. This particular implementation restricts values to those positive integer values that can be represented by the long data type. Provides sequenced 64-bit IDs.

Author:
Daniel Dyer

Constructor Summary
LongSequenceIDSource()
          Creates a sequence that starts at zero.
LongSequenceIDSource(long firstValue)
           
 
Method Summary
 Long nextID()
          Implementing classes are responsible for synchronization if concurrent invocations of this method are required.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LongSequenceIDSource

public LongSequenceIDSource(long firstValue)
Parameters:
firstValue - The value at which to start the sequence (must be non-negative).

LongSequenceIDSource

public LongSequenceIDSource()
Creates a sequence that starts at zero.

Method Detail

nextID

public Long nextID()
Implementing classes are responsible for synchronization if concurrent invocations of this method are required.

Specified by:
nextID in interface IDSource<Long>
Returns:
The next ID.

Watchmaker Framework API
(Version 0.6.2)