org.sape.carbon.services.threadpool
Interface ThreadPool

All Superinterfaces:
FunctionalInterface
All Known Implementing Classes:
DefaultThreadPoolImpl

public interface ThreadPool
extends FunctionalInterface

Thread pool components manage a number of Threads that can be used to execute miscellaneous tasks.
Copyright 2002 Sapient

Since:
carbon 2.1
Version:
$Revision: 1.5 $($Author: dvoet $ / $Date: 2003/11/20 18:49:59 $)
Author:
Douglas Voet, Nov 5, 2002

Method Summary
 TaskInfo execute(Runnable task, String taskName)
          Queues a task for execution.
 TaskInfo execute(Runnable task, String taskName, TaskCallback callback)
          Queues a task for execution.
 List getFailedTasks()
          Gets a read-only list of the tasks that failed during execution
 Integer getPoolSize()
          Gets the number of executions threads in the pool
 Integer getQueueSize()
          Gets the number of tasks currently in the queue.
 

Method Detail

execute

public TaskInfo execute(Runnable task,
                        String taskName)
Queues a task for execution.

Parameters:
task - the Runnable object that will be executed
taskName - the name of the task, used for logging and tracking
Returns:
an object that can be used to track task status

execute

public TaskInfo execute(Runnable task,
                        String taskName,
                        TaskCallback callback)
Queues a task for execution. Note that callbacks may execute on the pooled thread that executed the task.

Parameters:
task - the Runnable object that will be executed
taskName - the name of the task, used for logging and tracking
callback - the callback object that will be called when the task completes
Returns:
an object that can be used to track task status

getQueueSize

public Integer getQueueSize()
Gets the number of tasks currently in the queue. This does not include the number of tasks currently executing.

Returns:
number of tasks in the queue

getPoolSize

public Integer getPoolSize()
Gets the number of executions threads in the pool

Returns:
pool size

getFailedTasks

public List getFailedTasks()
Gets a read-only list of the tasks that failed during execution

Returns:
read-only list of the tasks that failed during execution


Copyright 1999-2003 Sapient Corporation. All Rights Reserved.