|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.continuent.tungsten.replicator.util.AtomicCounter
public class AtomicCounter
Defines a simple "atomic counter" that allows clients to increment the encapsulated sequence number and wait synchronously until particular values are reached. This class is thread-safe.
| Constructor Summary | |
|---|---|
AtomicCounter(long seqno)
Creates a new Sequencer object with a starting value. |
|
| Method Summary | |
|---|---|
long |
decrAndGetSeqno()
Decrement seqno and notify waiters, then return value. |
long |
getSeqno()
Get value of current seqno. |
long |
incrAndGetSeqno()
Increment seqno and notify waiters, then return value. |
void |
setSeqno(long seqno)
Sets values of current seqno. |
java.lang.String |
toString()
Print a string representation of the value. |
void |
waitSeqnoGreaterEqual(long waitSeqno)
Wait until seqno is greater than or equal to the desired value. |
boolean |
waitSeqnoGreaterEqual(long waitSeqno,
long millis)
Wait until seqno is greater than or equal to the desired value *or* we exceed the timeout. |
void |
waitSeqnoLessEqual(long waitSeqno)
Wait until seqno is less than or equal to the desired value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AtomicCounter(long seqno)
Sequencer object with a starting value.
seqno - Initial sequence number| Method Detail |
|---|
public long getSeqno()
public void setSeqno(long seqno)
public long incrAndGetSeqno()
public long decrAndGetSeqno()
public void waitSeqnoGreaterEqual(long waitSeqno)
throws java.lang.InterruptedException
waitSeqno - Sequence number to wait for
java.lang.InterruptedException - if somebody cancels the wait
public boolean waitSeqnoGreaterEqual(long waitSeqno,
long millis)
throws java.lang.InterruptedException
waitSeqno - Sequence number to wait formillis - Number of milliseconds to wait
java.lang.InterruptedException - if somebody cancels the wait
public void waitSeqnoLessEqual(long waitSeqno)
throws java.lang.InterruptedException
waitSeqno - Sequence number to wait for
java.lang.InterruptedException - if somebody cancels the waitpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||