public class ThreadPool
extends java.lang.Object
Constructor | Description |
---|---|
ThreadPool(int pMinPoolSize,
int pMaxPoolSize,
int pToleratedBacklog,
long pToleratedIdle,
java.lang.ThreadGroup pGroup,
java.lang.String pWorkerName) |
Ctor
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
execute(java.lang.Runnable task) |
Submits a task for execution
|
protected java.lang.ThreadGroup |
getGroup() |
Gets the associated thread group
|
java.lang.Runnable |
getNextTask(org.sblim.cimclient.internal.util.ThreadPool.Worker worker) |
Get a new task.
|
protected void |
removeWorker(org.sblim.cimclient.internal.util.ThreadPool.Worker worker) |
Removes a worker from the pool.
|
void |
shutdown() |
Shuts down the thread pool and all workers
|
void |
taskCompleted() |
Notifies the pool that at task was completed.
|
void |
taskStarted() |
Notifies the pool that at task was started.
|
public ThreadPool(int pMinPoolSize, int pMaxPoolSize, int pToleratedBacklog, long pToleratedIdle, java.lang.ThreadGroup pGroup, java.lang.String pWorkerName)
pMinPoolSize
- The minimal pool size. The pool will always keep at least this
number of worker threads alive even in no load situations.pMaxPoolSize
- The maximal pool size. The pool will create up to that number
of worker threads on heavy load.pToleratedBacklog
- The task backlog that is tolerated before an additional worker
is createdpToleratedIdle
- The idle time of a worker that is tolerated before the worker
is destroyedpGroup
- Then thread group to put the worker threads inpWorkerName
- The name to use for worker threadspublic boolean execute(java.lang.Runnable task)
task
- The tasktrue
if the task was executed or enqueued,
false
otherwise.protected void removeWorker(org.sblim.cimclient.internal.util.ThreadPool.Worker worker)
worker
- The workerprotected java.lang.ThreadGroup getGroup()
public java.lang.Runnable getNextTask(org.sblim.cimclient.internal.util.ThreadPool.Worker worker) throws java.lang.InterruptedException
worker
- The worker asking for a new taskjava.lang.InterruptedException
- on interruptpublic void taskStarted()
public void taskCompleted()
public void shutdown()
Copyright © 2005, 2013 IBM Corporation. All Rights Reserved.