com.sun.jini.outrigger
Class OperationJournal.TransitionIterator

java.lang.Object
  extended by com.sun.jini.outrigger.OperationJournal.TransitionIterator
Enclosing class:
OperationJournal

 class OperationJournal.TransitionIterator
extends Object

An iterator that will yield (in the order they were posted) all the EntryTransitions added after the iterator was created and processed before watcherRegistered was called. This call assumes it is only used by a single thread.


Field Summary
private  OperationJournal.JournalNode current
          Our current position in the journal
private  OperationJournal.JournalNode end
          The place to end, null if watcherRegistered has not yet been called.
 
Constructor Summary
private OperationJournal.TransitionIterator(OperationJournal.JournalNode node)
          Create a new TransitionIterator that will start with the first EntryTransition that appears in the journal after the passed JournalNode.
 
Method Summary
(package private)  long currentOrdinalAtCreation()
          Return the ordinal of the last operation posted when this iterator was created.
(package private)  EntryTransition next()
          Return the next EntryTransition in the sequence, or null if the end of the sequence has been reached.
(package private)  void watcherRegistered()
          Set the end of the iteration to ensure that any EntryTransition added after this iterator was created will either be returned by this iterator, or passed to the process() method of any watcher that was added to the watcher associated with the OperationJournal before this method was called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

end

private OperationJournal.JournalNode end
The place to end, null if watcherRegistered has not yet been called.


current

private OperationJournal.JournalNode current
Our current position in the journal

Constructor Detail

OperationJournal.TransitionIterator

private OperationJournal.TransitionIterator(OperationJournal.JournalNode node)
Create a new TransitionIterator that will start with the first EntryTransition that appears in the journal after the passed JournalNode.

Parameters:
node - Start the iteration with the first JournalNode after node that is for a EntryTransition.
Throws:
NullPointerException - if node is null.
Method Detail

next

EntryTransition next()
Return the next EntryTransition in the sequence, or null if the end of the sequence has been reached.

Returns:
The next EntryTransition in the sequence, or null if the end of the sequence has been reached.
Throws:
IllegalStateException - if watcherRegistered has not yet been called.

watcherRegistered

void watcherRegistered()
Set the end of the iteration to ensure that any EntryTransition added after this iterator was created will either be returned by this iterator, or passed to the process() method of any watcher that was added to the watcher associated with the OperationJournal before this method was called.

Throws:
IllegalStateException - if watcherRegistered has been called.

currentOrdinalAtCreation

long currentOrdinalAtCreation()
Return the ordinal of the last operation posted when this iterator was created. All the EntryTransitions yielded by this iterator will have higher ordinals.

Returns:
the current ordinal when this iterator was created.
Throws:
IllegalStateException - if watcherRegistered has been called.


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.