Class UnsynchronizedSequence

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

public class UnsynchronizedSequence extends Object implements Sequence
Generates incrementing identifiers in a thread-unsafe manner using a simple primitive without any synchronization.
Author:
AO Industries, Inc.
  • Constructor Details

    • UnsynchronizedSequence

      public UnsynchronizedSequence()
      Starts at the value of 1.
    • UnsynchronizedSequence

      public UnsynchronizedSequence(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