Jumpi v1.2.0

org.jumpi.spi.component
Interface SequenceGenerator

All Superinterfaces:
Component, Configurable, Manageable
All Known Implementing Classes:
SequenceGeneratorImpl

public interface SequenceGenerator
extends Component

A SequenceGenerator provides a thread-safe, strictly increasing sequence number.

The sequence number starts at 0 and increases by one each time getNext() is called. The getNext method can be called simultaneously by multiple threads. Concurrent threads calling getNext may never receive the same sequence number.

The SequenceGenerator is a Jumpi component. The Component lifecycle is detailled in Manageable. A SequenceGenerator only provides sequence values during the active lifetime of the instance.


Method Summary
 long getNext()
          Get the next sequence number.
 
Methods inherited from interface org.jumpi.spi.Configurable
configure, getName
 
Methods inherited from interface org.jumpi.spi.Manageable
manage
 

Method Detail

getNext

public long getNext()
Get the next sequence number. The sequence numbering starts at 0 and increases by 1 each time getNext is called. Must be thread-safe.

Returns:
the next sequence number.
Throws:
java.lang.IllegalStateException - if not started.

Jumpi v1.2.0

Copyright 2003, Peter Jonathan Klauser.