|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.opennms.core.concurrent.RunnableConsumerThreadPool
public class RunnableConsumerThreadPool
RunnableConsumerThreadPool class.
| Nested Class Summary | |
|---|---|
static interface |
RunnableConsumerThreadPool.RunnableCompletionListener
This interface is used to define a listener for the thread pool that is notified when an enqueued runnable completes. |
static interface |
RunnableConsumerThreadPool.RunnableErrorListener
This interface is used to define a listerer for the thread pool that is notified if an error occurs processing a runnable. |
| Field Summary |
|---|
| Fields inherited from interface org.opennms.core.fiber.Fiber |
|---|
RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED |
| Constructor Summary | |
|---|---|
RunnableConsumerThreadPool(String name,
float loMark,
float hiMark,
int max)
Constructs a new instance of the thread pool class. |
|
| Method Summary | |
|---|---|
void |
addCompletionListener(RunnableConsumerThreadPool.RunnableCompletionListener listener)
Adds a listener that is notified upon completion of each runnable. |
void |
addErrorListener(RunnableConsumerThreadPool.RunnableErrorListener listener)
Adds a listener that is notified of error from any runnable. |
String |
getName()
Returns the name of the thread pool. |
FifoQueue<Runnable> |
getRunQueue()
Returns the input queue where Runnableobjects
are enqueued. |
int |
getStatus()
Returns the current status of the fiber. |
void |
removeCompletionListener(RunnableConsumerThreadPool.RunnableCompletionListener listener)
Removes a previous register listener. |
void |
removeErrorListener(RunnableConsumerThreadPool.RunnableErrorListener listener)
Removes a previous register listener. |
void |
start()
Starts the thread pool. |
void |
stop()
Begins the shutdown process of the thread pool. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RunnableConsumerThreadPool(String name,
float loMark,
float hiMark,
int max)
Constructs a new instance of the thread pool class. The thread pool
consumes Runnableinstances from the input
queue, calling the run method as they are consumed.
The size of the thread pool is controlled by the low and high water marks, each water mark being the ratio of queue elements to threads. As the ratio grows past the high water mark more threads are added, up to the maximum amount. As the ratio drops past the low water mark the number of threads are reduced.
name - The name of the thread pool.loMark - The lower ratio used to mark thread reduction.hiMark - The high ration used to mark thread production.max - The maximum number of threads in the pool.
IllegalArgumentException - Thrown if the low or high marks are invalid, or the
maximum number of threads is invalid.| Method Detail |
|---|
public FifoQueue<Runnable> getRunQueue()
Runnableobjects
are enqueued. Each runnable object will be executed in the order that it
is entered.
public void start()
start in interface Fiberpublic void stop()
stop in interface Fiberpublic int getStatus()
getStatus in interface Fiberpublic String getName()
getName in interface Fiberpublic void addCompletionListener(RunnableConsumerThreadPool.RunnableCompletionListener listener)
listener - The listener notified on runnable completion.public void removeCompletionListener(RunnableConsumerThreadPool.RunnableCompletionListener listener)
listener - The listener to remove from notification.public void addErrorListener(RunnableConsumerThreadPool.RunnableErrorListener listener)
listener - The listener notified on runnable completion.public void removeErrorListener(RunnableConsumerThreadPool.RunnableErrorListener listener)
listener - The listener to remove from notification.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||