|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.d_haven.event.command.AbstractThreadPolicy
public abstract class AbstractThreadPolicy
The AbstractThreadPolicy keeps track of wether the management thread is running or not, and stores the ThreadManager for future use.
| Field Summary | |
|---|---|
private ThreadManager |
m_manager
|
private boolean |
m_running
|
| Constructor Summary | |
|---|---|
AbstractThreadPolicy()
|
|
| Method Summary | |
|---|---|
protected void |
endLoop()
Provide a hook to do further cleanup when we end the management loop. |
void |
executeLoop(ThreadManager manager)
Take care of the standard checks that need to be in place, and then delegate to the startLoop() method to do any further
initialization. |
boolean |
isRunning()
Returns whether this ThreadPolicy is currently running or not. |
protected abstract void |
process(java.util.Collection pipelines)
Do the actual management logic that needs to be done in each time through the main loop. |
void |
run()
Do the actual looping code. |
protected abstract void |
startLoop()
Provide a hook to do further initialization when we start the management loop. |
void |
terminateLoop()
Stops the loop and calls the endLoop() method to do any
further tear down. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.d_haven.event.command.ThreadPolicy |
|---|
createRunner, setThreadFactory |
| Field Detail |
|---|
private ThreadManager m_manager
private volatile boolean m_running
| Constructor Detail |
|---|
public AbstractThreadPolicy()
| Method Detail |
|---|
public void executeLoop(ThreadManager manager)
throws java.lang.InterruptedException
startLoop() method to do any further
initialization.
executeLoop in interface ThreadPolicymanager - the ThreadManager to run the pipelines through
java.lang.InterruptedException - if the calling thread is interruptedpublic boolean isRunning()
isRunning in interface ThreadPolicytrue if the management thread is running
public void terminateLoop()
throws java.lang.InterruptedException
endLoop() method to do any
further tear down.
terminateLoop in interface ThreadPolicyjava.lang.InterruptedException - if the calling thread is interruptedpublic void run()
process(java.util.Collection) method.
run in interface java.lang.Runnable
protected abstract void process(java.util.Collection pipelines)
throws java.lang.Exception
pipelines - The pipelines to manage
java.lang.Exception - if there is a problem or the thread is
interrupted
protected abstract void startLoop()
throws java.lang.InterruptedException
run() method. This object is Runnable
so you can pass it in to a new thread.
java.lang.InterruptedException - if the calling thread is interrupted
protected void endLoop()
throws java.lang.InterruptedException
java.lang.InterruptedException - if the calling thread is interrupted
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||