java.lang.Object
com.aoapps.lang.util.AtomicSequence
- All Implemented Interfaces:
Sequence
Generates incrementing identifiers in a thread-safe manner using atomic
primitives.
- Author:
- AO Industries, Inc.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
Gets the next value from the sequence.void
setNextSequenceValue
(long nextValue)
-
Constructor Details
-
AtomicSequence
public AtomicSequence()Starts at the value of 1. -
AtomicSequence
public AtomicSequence(long initialValue)
-
-
Method Details
-
getNextSequenceValue
public long getNextSequenceValue()Description copied from interface:Sequence
Gets the next value from the sequence.- Specified by:
getNextSequenceValue
in interfaceSequence
-
setNextSequenceValue
public void setNextSequenceValue(long nextValue) - Specified by:
setNextSequenceValue
in interfaceSequence
-