ibis.util
Class Sequencer

java.lang.Object
  extended byibis.util.Sequencer

public final class Sequencer
extends java.lang.Object

The Sequencer class provides a global numbering. This can be used, for instance, for global ordering of messages. A sender must then first obtain a sequence number from the sequencer, and tag the message with it. The receiver must then handle the messages in the "tag" order.

A Sequencer associates a numbering scheme with a name, so the user can associate different sequences with different names.

A Sequencer is obtained by means of the getSequencer(ibis.ipl.Ibis) method. A sequence number is obtained from a sequencer seq by the seq.getSeqno(name) call.


Field Summary
static int START_SEQNO
          The first sequence number that gets given out.
 
Method Summary
 int getSeqno(java.lang.String name)
          Returns the next sequence number associated with the specified name.
static Sequencer getSequencer(Ibis ibis)
          Returns a sequencer for the specified Ibis instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

START_SEQNO

public static final int START_SEQNO
The first sequence number that gets given out.

See Also:
Constant Field Values
Method Detail

getSequencer

public static Sequencer getSequencer(Ibis ibis)
                              throws java.io.IOException
Returns a sequencer for the specified Ibis instance. This sequencer can then be used to obtain sequence numbers from.

Parameters:
ibis - the Ibis instance for which a sequencer must be obtained
Returns:
the sequencer
Throws:
java.io.IOException - gets thrown in case of trouble

getSeqno

public int getSeqno(java.lang.String name)
             throws java.io.IOException
Returns the next sequence number associated with the specified name.

Parameters:
name - the name of the sequence.
Returns:
the next sequence number
Throws:
java.io.IOException - gets thrown in case of trouble


The Ibis project