|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openmdx.base.concurrent.locks.StateTransitions
public class StateTransitions
State Transitions
| Constructor Summary | |
|---|---|
StateTransitions(Enum initialState)
Constructor |
|
StateTransitions(Enum initial,
String id,
boolean debug)
Constructor |
|
| Method Summary | |
|---|---|
void |
assertState(Enum expected)
Tests whether the expected Status matches the current one. |
void |
assertState(EnumSet expected)
Tests whether the current Status value is among the
expected ones. |
void |
awaitState(EnumSet stati,
java.util.concurrent.locks.Condition event)
Wait for one of a given set of states |
boolean |
awaitState(EnumSet stati,
java.util.concurrent.locks.Condition event,
long timeout)
Wait for one of a given set of states |
Enum |
getState()
Retrieve the state. |
void |
setState(java.util.concurrent.locks.Condition event,
Enum state)
Set the state |
void |
setState(Enum state)
Set the state |
boolean |
stateMatches(Enum state)
Test whether the current state matches a given one. |
boolean |
stateMatches(EnumSet stati)
Test whether the current state matches a given one. |
String |
toString()
|
void |
transition(Enum from,
java.util.concurrent.locks.Condition event,
Enum to)
Change the state |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public StateTransitions(Enum initialState)
initialState - the initial state
public StateTransitions(Enum initial,
String id,
boolean debug)
initial - id - the id used for log() and toString()debug - tells whether logging is enabled| Method Detail |
|---|
public Enum getState()
status's valuepublic boolean stateMatches(Enum state)
true if the current state queals the given one.public boolean stateMatches(EnumSet stati)
true if the current state queals the given one.public void setState(Enum state)
state - The status's value
public final void setState(java.util.concurrent.locks.Condition event,
Enum state)
event - the event leading to thei change in statestate - The status's valuepublic void assertState(Enum expected)
Status matches the current one.
expected - the expected Status
IllegalStateException - if the expected Status does
not match the current onepublic void assertState(EnumSet expected)
Status value is among the
expected ones.
expected - the expected Status set
IllegalStateException - if the current Status is not
among the expected ones
public void transition(Enum from,
java.util.concurrent.locks.Condition event,
Enum to)
from - event - to -
public boolean awaitState(EnumSet stati,
java.util.concurrent.locks.Condition event,
long timeout)
throws InterruptedException
stati - the status one is waiting forcondition - the condition leading to the awaited transitiontimeout - the timeout in milliseconds
true if one of the requested states has been
reached; false if the method timed out.
InterruptedException - if the thread is interrupted
public void awaitState(EnumSet stati,
java.util.concurrent.locks.Condition event)
throws InterruptedException
stati - the status one is waiting forcondition - the condition leading to the awaited transition
InterruptedException - if the thread is interruptedpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||