com.sun.grid.installer.task
public class ThreadPoolObserver extends java.lang.Object
ThreadPoolExecutor
sModifier and Type | Class and Description |
---|---|
class |
ThreadPoolObserver.ThreadPoolEvent
Event fired by
ThreadPoolObserver |
static interface |
ThreadPoolObserver.ThreadPoolListener
Listener interface for capturing
ThreadPoolObserver.ThreadPoolEvent s |
Constructor and Description |
---|
ThreadPoolObserver()
Constructor
|
ThreadPoolObserver(java.util.concurrent.ThreadPoolExecutor threadPoolExecutor)
Constructor
|
ThreadPoolObserver(java.util.concurrent.ThreadPoolExecutor[] threadPoolExecutors)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addThreadPoolListener(ThreadPoolObserver.ThreadPoolListener threadPoolListener)
|
boolean |
areTasksReady() |
protected void |
fireThreadPoolEvent(int type)
Propagates the event to the listeners
|
int |
getActiveCount()
Returns the sum of active tasks
|
int |
getCompletedTaskCount()
Returns the sum of completed tasks
|
int |
getLastRunCompletedTaskCount()
Returns with completed task count of the last run
|
int |
getLastRunTaskCount()
Returns with task count of the last run
|
int |
getPoolSize()
Returns the sum of pool sizes
|
int |
getTaskCount()
Returns the sum of tasks
|
boolean |
isFinished()
Indicates whether the observaton has been finished
|
boolean |
isStarted()
Indicates whether the observaton has been started
|
void |
observe()
Starts the observation of the thread pool(s)
|
void |
removeThreadPoolListener(ThreadPoolObserver.ThreadPoolListener threadPoolListener)
Removes the
ThreadPoolObserver.ThreadPoolListener . |
void |
setTaskCount(int taskCount)
Sets the overall sum of tasks.
|
void |
setThreadPoolExecutors(java.util.concurrent.ThreadPoolExecutor threadPoolExecutor) |
void |
setThreadPoolExecutors(java.util.concurrent.ThreadPoolExecutor[] threadPoolExecutors) |
void |
shutDown()
Stops the observation
|
public ThreadPoolObserver()
public ThreadPoolObserver(java.util.concurrent.ThreadPoolExecutor threadPoolExecutor)
threadPoolExecutor
- The ThreadPoolExecutor
to be observedpublic ThreadPoolObserver(java.util.concurrent.ThreadPoolExecutor[] threadPoolExecutors)
threadPoolExecutors
- The array of ThreadPoolExecutor
s to be observedpublic void setThreadPoolExecutors(java.util.concurrent.ThreadPoolExecutor threadPoolExecutor)
public void setThreadPoolExecutors(java.util.concurrent.ThreadPoolExecutor[] threadPoolExecutors)
public void observe()
public void shutDown()
public boolean isStarted()
public boolean isFinished()
public void setTaskCount(int taskCount)
getLastRunTaskCount()
returns with this value
instead of the one counted from the current thread pools.taskCount
- Sets the overall sum of tasks.public void addThreadPoolListener(ThreadPoolObserver.ThreadPoolListener threadPoolListener)
threadPoolListener
- The ThreadPoolObserver.ThreadPoolListener
to be added.public void removeThreadPoolListener(ThreadPoolObserver.ThreadPoolListener threadPoolListener)
ThreadPoolObserver.ThreadPoolListener
.threadPoolListener
- The ThreadPoolObserver.ThreadPoolListener
to be removed.protected void fireThreadPoolEvent(int type)
type
- The type of the eventsThreadPoolObserver.ThreadPoolEvent
public boolean areTasksReady()
public int getLastRunTaskCount()
getTaskCount()
public int getLastRunCompletedTaskCount()
getCompletedTaskCount()
public int getTaskCount()
public int getActiveCount()
public int getPoolSize()
public int getCompletedTaskCount()