org.d_haven.event.command
public class ProcessorBoundThreadPolicy extends AbstractThreadPolicy
Field Summary | |
---|---|
static long | DEFAULT_WAIT_TIME |
PooledExecutor | m_executor |
int | m_numThreads |
long | m_waitTime |
Constructor Summary | |
---|---|
ProcessorBoundThreadPolicy()
Create a new ProcessorBoundThreadPolicy with one thread per
processor and a default wait time of one second between runs. | |
ProcessorBoundThreadPolicy(int multiplier)
Create a new ProcessorBoundThreadPolicy with the number of
threads equal to the number of processor multiplied by the
supplied multiplier. | |
ProcessorBoundThreadPolicy(int multiplier, long waitTime)
Create a new ProcessorBoundThreadPolicy with the number of
threads equal to the number of processor multiplied by the
supplied multiplier. |
Method Summary | |
---|---|
EventPipelineRunner | createRunner(EventPipeline pipeline) |
protected void | endLoop() |
int | getNumThreads()
Get the number of threads to use for running the pipelines.
|
ThreadFactory | getThreadFactory()
Get the ThreadFactory used to create new threads.
|
long | getWaitTime()
Get the time we wait between runs of the pipeline.
|
protected void | process(Collection pipelines) |
void | setThreadFactory(ThreadFactory factory) |
protected void | startLoop() |
String | toString() |
Parameters: multiplier the multiplier against the number of threads
Throws: IllegalArgumentException if the multiplier is less than 1
Parameters: multiplier the multiplier against the number of threads waitTime the time to wait between runs
Throws: IllegalArgumentException if the multiplier or waitTime is less than 1
Returns: the number of threads
Returns: the thread factory
Returns: the wait time in ms