Class AtomicSequence

java.lang.Object
com.aoapps.lang.util.AtomicSequence
All Implemented Interfaces:
Sequence

public class AtomicSequence extends Object implements Sequence
Generates incrementing identifiers in a thread-safe manner using atomic primitives.
Author:
AO Industries, Inc.
  • 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 interface Sequence
    • setNextSequenceValue

      public void setNextSequenceValue(long nextValue)
      Specified by:
      setNextSequenceValue in interface Sequence