|
Bees v0.5.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--bees.core.Coroutine
A Coroutine is a base class for handling events exchanged between domains.
Field Summary | |
static long |
DEFAULT_TIMEOUT
Default timeout for events sent between coroutines. |
static long |
INVALID_ID
An invalid coroutine identifier. |
static int |
STATE_ANY
|
static int |
STATE_COMPLETE
|
static int |
STATE_ERROR
|
static int |
STATE_ERROR_CAGED
|
static int |
STATE_ERROR_INTERNAL
|
static int |
STATE_ERROR_TIMEOUT
|
static int |
STATE_ERROR_USER
|
static int |
STATE_NEWBORN
|
static int |
STATE_USER
|
Constructor Summary | |
protected |
Coroutine()
Construct a coroutine and initialize it with a unique identifier. |
Method Summary | |
void |
cleanup()
Call back used to cleanup coroutines that are still in progress when a BDomain has been shutdown. |
void |
drop()
Drop the Coroutine, which entails setting the unique identifier to INVALID_ID. |
protected void |
finalize()
|
static Coroutine |
getCoroutine(BeesEvent ae)
|
long |
getID()
|
int |
getState()
|
java.lang.Throwable |
getThrowable()
|
abstract void |
handle(BeesEvent ae)
Callback used to handle BeesEvents directed to this Coroutine. |
protected void |
setState(int newState)
Set the state of the Coroutine and notify any waiting threads. |
protected void |
setThrowable(java.lang.Throwable throwable)
|
java.lang.String |
toString()
|
boolean |
waitForCompletion()
Wait for the Coroutine to reach STATE_COMPLETE. |
boolean |
waitForCompletion(long timeout)
Wait for the Coroutine to reach STATE_COMPLETE. |
int |
waitForState(int state)
|
int |
waitForState(int nextState,
long timeout)
|
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final long INVALID_ID
public static final int STATE_ERROR_USER
public static final int STATE_ERROR_TIMEOUT
public static final int STATE_ERROR_CAGED
public static final int STATE_ERROR_INTERNAL
public static final int STATE_ERROR
public static final int STATE_ANY
public static final int STATE_NEWBORN
public static final int STATE_USER
public static final int STATE_COMPLETE
public static final long DEFAULT_TIMEOUT
Constructor Detail |
protected Coroutine()
Method Detail |
public static Coroutine getCoroutine(BeesEvent ae)
ae
- The BeesEvent that should be matched to a coroutine.public final long getID()
protected void setState(int newState)
newState
- The new state value.public final int getState()
protected final void setThrowable(java.lang.Throwable throwable)
throwable
- The exception that disabled this Coroutine.public final java.lang.Throwable getThrowable()
public int waitForState(int nextState, long timeout)
nextState
- The state to wait for.timeout
- The amount of time to wait before setting the state to
STATE_ERROR_TIMEOUT and returning.public int waitForState(int state)
state
- The state to wait for.public boolean waitForCompletion(long timeout)
timeout
- The amount of time to wait before setting the state to
STATE_ERROR_TIMEOUT and returning.public boolean waitForCompletion()
public abstract void handle(BeesEvent ae)
ae
- The BeesEvent to handle.public void cleanup()
public void drop()
protected void finalize()
finalize
in class java.lang.Object
Object.finalize()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
|
Bees v0.5.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |