|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.asyncobjects.vats.VatRunner net.sf.asyncobjects.vats.VatQueueRunner net.sf.asyncobjects.vats.SingleThreadIdleRunner
public abstract class SingleThreadIdleRunner
This base class for runners allows executing some idle action instead of blocking on vat queue.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class net.sf.asyncobjects.vats.VatQueueRunner |
---|
VatQueueRunner.EnqueuedVat |
Nested classes/interfaces inherited from class net.sf.asyncobjects.vats.VatRunner |
---|
VatRunner.VatRunnerState |
Field Summary | |
---|---|
protected boolean |
isIdle
if true, the action is currently idle |
Fields inherited from class net.sf.asyncobjects.vats.VatQueueRunner |
---|
queue |
Fields inherited from class net.sf.asyncobjects.vats.VatRunner |
---|
state, stateLock |
Constructor Summary | |
---|---|
SingleThreadIdleRunner()
A constructor |
|
SingleThreadIdleRunner(String threadName,
boolean isDaemon)
A constructor |
Method Summary | |
---|---|
protected boolean |
hasEvents(Vat vat,
Object ticket)
This method is called by the vat when new events have arrived. |
protected abstract void |
idle()
perform idle action, idle action should stop to be performed after wakeup call. |
protected void |
init()
Init the vat |
protected boolean |
isStopping()
|
protected void |
pollIdle()
poll action, poll should never block. |
void |
resumeInCurrentThread()
This methods resumes the suspended runner in the current thread. |
protected void |
setPollInterval(int n)
Set poll interval |
void |
startInCurrentThread()
Start runner in the current thread. |
void |
startInNewThread()
Start vat in new thread |
void |
stop()
Stop this runner |
protected void |
stopped()
After vat is stopped |
protected void |
stopping()
Stopping the vat |
void |
suspend()
This method cases the runner to suspend its work. |
protected abstract void |
wakeupIdle()
wakeup idle action and perform, wakeupIdle should be ready to fact that it will be called several times and that it could be called before actual entering into idle call. |
Methods inherited from class net.sf.asyncobjects.vats.VatRunner |
---|
cancelledEqueuedVat, getBachingFactor, getState, newVat, newVat, setBachingFactor, setStarted, setStarting, setState, setStopped, setStopping |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.asyncobjects.vats.VatFactory |
---|
newVat, newVat |
Field Detail |
---|
protected boolean isIdle
Constructor Detail |
---|
public SingleThreadIdleRunner(String threadName, boolean isDaemon)
threadName
- a thread nameisDaemon
- if true a thread will be a daemon threadpublic SingleThreadIdleRunner()
Method Detail |
---|
protected void setPollInterval(int n)
n
- a poll turnsprotected boolean hasEvents(Vat vat, Object ticket)
VatRunner
hasEvents
in class VatQueueRunner
vat
- a vat that has new events and is associated with the runnerticket
- a ticket from the vat
VatQueueRunner.hasEvents(net.sf.asyncobjects.vats.Vat,
java.lang.Object)
public void startInCurrentThread()
startInCurrentThread
in interface ThreadBasedRunner
public void startInNewThread()
startInNewThread
in interface ThreadBasedRunner
public void stop()
stop
in interface ThreadBasedRunner
protected void init()
protected void stopping()
protected void stopped()
protected abstract void idle()
protected abstract void wakeupIdle()
protected void pollIdle()
protected boolean isStopping()
public void suspend()
ThreadBasedRunner
suspend
in interface ThreadBasedRunner
ThreadBasedRunner.suspend()
public void resumeInCurrentThread()
ThreadBasedRunner
resumeInCurrentThread
in interface ThreadBasedRunner
ThreadBasedRunner.resumeInCurrentThread()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |