public abstract class AbstractThreadPolicy extends java.lang.Object implements ThreadPolicy, java.lang.Runnable
| Modifier and Type | Field and Description |
|---|---|
private ThreadManager |
m_manager |
private boolean |
m_running |
| Constructor and Description |
|---|
AbstractThreadPolicy() |
| Modifier and Type | Method and Description |
|---|---|
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. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateRunner, setThreadFactoryprivate ThreadManager m_manager
private volatile boolean m_running
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 throughjava.lang.InterruptedException - if the calling thread is interruptedpublic boolean isRunning()
isRunning in interface ThreadPolicytrue if the management thread is runningpublic 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.Runnableprotected abstract void process(java.util.Collection pipelines)
throws java.lang.Exception
pipelines - The pipelines to managejava.lang.Exception - if there is a problem or the thread is
interruptedprotected 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 interruptedprotected void endLoop()
throws java.lang.InterruptedException
java.lang.InterruptedException - if the calling thread is interrupted