public interface WorkerPool
WorkerPool interface models an abstract pool of workers
(threads) which can execute WorkerTasks concurrently.| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancels all threads non-blocking by interrupting them.
|
void |
execute(WorkerTask task)
Executes a task on behalf of this worker pool.
|
boolean |
isIdle()
Checks if all workers of the pool are idle.
|
void |
stop()
Stops all threads in this worker pool gracefully.
|
boolean |
tryToExecute(WorkerTask task)
Tries to execute a task on behalf of this worker pool.
|
void execute(WorkerTask task)
task - a Runnable to execute.boolean tryToExecute(WorkerTask task)
false. Otherwise the task
is executed in background.task - a Runnable to execute.true if the task is executing.void stop()
void cancel()
boolean isIdle()
true if all workers are idle.Copyright © 2016 SNMP4J.org. All Rights Reserved.