|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread biz.chitec.quarterback.util.AsyncEventThread
Arbitrary asynchronous thread which handles something in an event-driven way. Modelled after AsyncEventDispatcher, which was developed earlier but static-only. This class works by starting a private subthread. That one is listening at a ThreadInterface. It receives AsyncEvents which contain either an AsyncEventHandler or a Runnable. That ones handling method (either AsyncEventHandler.handleAsyncEvent() or Runnable.run()) is executed in the asynchronous thread. Note: You have to call start() after instantiating AsyncEventThread. Otherwise, nothing will be executed. Call close() to finish operation. Tasks will be executed before operation stops, anyway.
AsyncEvent
,
AsyncEventHandler
Field Summary | |
private ThreadInterface |
ti
|
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
AsyncEventThread()
|
Method Summary | |
void |
close()
|
void |
invokeIfSleeping(AsyncEventHandler target)
|
void |
invokeIfSleeping(java.util.EventObject e,
AsyncEventHandler target)
|
void |
invokeIfSleeping(java.lang.Runnable target)
|
void |
invokeIfSleeping(java.lang.Runnable target,
java.lang.Runnable alternative)
Calls target in async thread if that one is free or alternative in current thread. |
void |
invokeLater(AsyncEventHandler target)
|
void |
invokeLater(java.util.EventObject e,
AsyncEventHandler target)
|
void |
invokeLater(java.lang.Runnable target)
|
boolean |
isIdle()
|
boolean |
isMyThread()
Returns true if running in the asynchronous dispatching thread handled by this class. |
void |
run()
The asynchronous event handler |
void |
sendEvent(AsyncEvent ae)
|
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private ThreadInterface ti
Constructor Detail |
public AsyncEventThread()
Method Detail |
public void close()
public boolean isMyThread()
public boolean isIdle()
public void sendEvent(AsyncEvent ae)
public void invokeLater(AsyncEventHandler target)
public void invokeLater(java.util.EventObject e, AsyncEventHandler target)
public void invokeIfSleeping(AsyncEventHandler target)
public void invokeIfSleeping(java.util.EventObject e, AsyncEventHandler target)
public void invokeLater(java.lang.Runnable target)
public void invokeIfSleeping(java.lang.Runnable target)
public void invokeIfSleeping(java.lang.Runnable target, java.lang.Runnable alternative)
public void run()
|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |