org.sape.carbon.services.threadpool
Interface ThreadPoolConfiguration

All Superinterfaces:
ComponentConfiguration, Configuration

public interface ThreadPoolConfiguration
extends ComponentConfiguration

Configuration for the DefaultThreadPoolImpl.
Copyright 2002 Sapient

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

Field Summary
static boolean DiscardQueuedTasksOnShutdown
          DiscardQueuedTasksOnShutdown tells the thread pool whether or not to wait for queued tasks to complete execution when the service is stopped.
static int FailureListCapacity
          FailureListCapacity limits the number of failures that are tracked.
static int InitialThreadCount
          InitialThreadCount tells the thread pool how many threads to create when it starts.
static int KeepAliveTime
          If a thread in the pool has been idle longer than KeepAliveTime (measured in milliseconds), it will be allowed to terminate, releasing its resources.
static QueueFullPolicyEnum QueueFullPolicy
          QueueFullPolicy determines how the thread pool deals with new execute requests when the pending queue is already full.
static long ShutdownWaitTime
          If DiscardQueuedTasksOnShutdown is true, ShutdownWaitTime tells the thread pool how long to wait in milliseconds for queued tasks to complete execution.
static boolean UseDaemonThreads
          Tells the thread pool whether or not to use daemon threads.
 
Fields inherited from interface org.sape.carbon.core.component.ComponentConfiguration
ComponentTemplateName
 
Method Summary
 boolean getDiscardQueuedTasksOnShutdown()
          DiscardQueuedTasksOnShutdown tells the thread pool whether or not to wait for queued tasks to complete execution when the service is stopped.
 int getFailureListCapacity()
          FailureListCapacity limits the number of failures that are tracked.
 int getInitialThreadCount()
           
 int getKeepAliveTime()
          If a thread in the pool has been idle longer than KeepAliveTime (measured in milliseconds), it will be allowed to terminate, releasing its resources.
 QueueFullPolicyEnum getQueueFullPolicy()
          QueueFullPolicy determines how the thread pool deals with new execute requests when the pending queue is already full.
 long getShutdownWaitTime()
          If DiscardQueuedTasksOnShutdown is true, ShutdownWaitTime tells the thread pool how long to wait in milliseconds for queued tasks to complete execution.
 int getTaskQueueSize()
          TaskQueueSize limits the number of tasks that can be waiting for execution.
 int getThreadPoolSize()
          ThreadPoolSize determines the number of threads in the pool.
 boolean isUseDaemonThreads()
          Tells the thread pool whether or not to use daemon threads.
 void setDiscardQueuedTasksOnShutdown(boolean discardTasks)
          DiscardQueuedTasksOnShutdown tells the thread pool whether or not to wait for queued tasks to complete execution when the service is stopped.
 void setFailureListCapacity(int capacity)
          FailureListCapacity limits the number of failures that are tracked.
 void setInitialThreadCount(int count)
           
 void setKeepAliveTime(int milliseconds)
          If a thread in the pool has been idle longer than KeepAliveTime (measured in milliseconds), it will be allowed to terminate, releasing its resources.
 void setQueueFullPolicy(QueueFullPolicyEnum policy)
          QueueFullPolicy determines how the thread pool deals with new execute requests when the pending queue is already full.
 void setShutdownWaitTime(long milliseconds)
          If DiscardQueuedTasksOnShutdown is true, ShutdownWaitTime tells the thread pool how long to wait in milliseconds for queued tasks to complete execution.
 void setTaskQueueSize(int size)
          TaskQueueSize limits the number of tasks that can be waiting for execution.
 void setThreadPoolSize(int size)
          ThreadPoolSize determines the number of threads in the pool.
 void setUseDaemonThreads(boolean useDaemonThreads)
          Tells the thread pool whether or not to use daemon threads.
 
Methods inherited from interface org.sape.carbon.core.component.ComponentConfiguration
getComponentDescription, getComponentTemplateName, getFunctionalImplementationClass, getFunctionalInterface, setComponentDescription, setComponentTemplateName, setFunctionalImplementationClass, setFunctionalInterface
 
Methods inherited from interface org.sape.carbon.core.config.Configuration
clone, getConfigurationInterface, getConfigurationName, getDataStructure, getRootElement, isConfigurationWritable, setConfigurationName, setConfigurationReadOnly
 

Field Detail

FailureListCapacity

public static final int FailureListCapacity
FailureListCapacity limits the number of failures that are tracked. When this list fills, the oldest failure is removed before adding the newest failure. Defaults to 100.

See Also:
Constant Field Values

UseDaemonThreads

public static final boolean UseDaemonThreads
Tells the thread pool whether or not to use daemon threads. Defaults to true. From the java.lang.Thread javadoc, "The Java Virtual Machine exits when the only threads running are all daemon threads."

See Also:
Thread.setDaemon(boolean), Constant Field Values

KeepAliveTime

public static final int KeepAliveTime
If a thread in the pool has been idle longer than KeepAliveTime (measured in milliseconds), it will be allowed to terminate, releasing its resources. If this is set to 0, the thread will not terminate unless interrupted. Defaults to 300000 (5 minutes).

See Also:
Constant Field Values

QueueFullPolicy

public static final QueueFullPolicyEnum QueueFullPolicy
QueueFullPolicy determines how the thread pool deals with new execute requests when the pending queue is already full. Defaults to QueueFullPolicyEnum.RUN which means that the new task will execute on the current thread, not a pooled thread.

See Also:
QueueFullPolicyEnum

InitialThreadCount

public static final int InitialThreadCount
InitialThreadCount tells the thread pool how many threads to create when it starts. Note that if KeepAliveTime is non-zero, these threads may terminate. Defaults to 0.

See Also:
Constant Field Values

ShutdownWaitTime

public static final long ShutdownWaitTime
If DiscardQueuedTasksOnShutdown is true, ShutdownWaitTime tells the thread pool how long to wait in milliseconds for queued tasks to complete execution. Defaults to 1000 (1 second).

See Also:
Constant Field Values

DiscardQueuedTasksOnShutdown

public static final boolean DiscardQueuedTasksOnShutdown
DiscardQueuedTasksOnShutdown tells the thread pool whether or not to wait for queued tasks to complete execution when the service is stopped. Defaults to false.

See Also:
Constant Field Values
Method Detail

getThreadPoolSize

public int getThreadPoolSize()
ThreadPoolSize determines the number of threads in the pool. Depending on the the values of InitialThreadCount and KeepAliveTime, there may be fewer threads in the pool, but never more. Required.


setThreadPoolSize

public void setThreadPoolSize(int size)
ThreadPoolSize determines the number of threads in the pool. Depending on the the values of InitialThreadCount and KeepAliveTime, there may be fewer threads in the pool, but never more. Required.


getFailureListCapacity

public int getFailureListCapacity()
FailureListCapacity limits the number of failures that are tracked. When this list fills, the oldest failure is removed before adding the newest failure. Defaults to 100.


setFailureListCapacity

public void setFailureListCapacity(int capacity)
FailureListCapacity limits the number of failures that are tracked. When this list fills, the oldest failure is removed before adding the newest failure. Defaults to 100.


isUseDaemonThreads

public boolean isUseDaemonThreads()
Tells the thread pool whether or not to use daemon threads. Defaults to true. From the java.lang.Thread javadoc, "The Java Virtual Machine exits when the only threads running are all daemon threads."

See Also:
Thread.setDaemon(boolean)

setUseDaemonThreads

public void setUseDaemonThreads(boolean useDaemonThreads)
Tells the thread pool whether or not to use daemon threads. Defaults to true. From the java.lang.Thread javadoc, "The Java Virtual Machine exits when the only threads running are all daemon threads."

See Also:
Thread.setDaemon(boolean)

getKeepAliveTime

public int getKeepAliveTime()
If a thread in the pool has been idle longer than KeepAliveTime (measured in milliseconds), it will be allowed to terminate, releasing its resources. If this is set to 0, the thread will not terminate unless interrupted. Defaults to 300000 (5 minutes).


setKeepAliveTime

public void setKeepAliveTime(int milliseconds)
If a thread in the pool has been idle longer than KeepAliveTime (measured in milliseconds), it will be allowed to terminate, releasing its resources. If this is set to 0, the thread will not terminate unless interrupted. Defaults to 300000 (5 minutes).


getQueueFullPolicy

public QueueFullPolicyEnum getQueueFullPolicy()
QueueFullPolicy determines how the thread pool deals with new execute requests when the pending queue is already full. Defaults to QueueFullPolicyEnum.RUN which means that the new task will execute on the current thread, not a pooled thread.

See Also:
QueueFullPolicyEnum

setQueueFullPolicy

public void setQueueFullPolicy(QueueFullPolicyEnum policy)
QueueFullPolicy determines how the thread pool deals with new execute requests when the pending queue is already full. Defaults to QueueFullPolicyEnum.RUN which means that the new task will execute on the current thread, not a pooled thread.

See Also:
QueueFullPolicyEnum

getTaskQueueSize

public int getTaskQueueSize()
TaskQueueSize limits the number of tasks that can be waiting for execution. This is required and must be greater than 0.


setTaskQueueSize

public void setTaskQueueSize(int size)
TaskQueueSize limits the number of tasks that can be waiting for execution. This is required and must be greater than 0.


getInitialThreadCount

public int getInitialThreadCount()

setInitialThreadCount

public void setInitialThreadCount(int count)

getShutdownWaitTime

public long getShutdownWaitTime()
If DiscardQueuedTasksOnShutdown is true, ShutdownWaitTime tells the thread pool how long to wait in milliseconds for queued tasks to complete execution. Defaults to 1000 (1 second).


setShutdownWaitTime

public void setShutdownWaitTime(long milliseconds)
If DiscardQueuedTasksOnShutdown is true, ShutdownWaitTime tells the thread pool how long to wait in milliseconds for queued tasks to complete execution. Defaults to 1000 (1 second).


getDiscardQueuedTasksOnShutdown

public boolean getDiscardQueuedTasksOnShutdown()
DiscardQueuedTasksOnShutdown tells the thread pool whether or not to wait for queued tasks to complete execution when the service is stopped. Defaults to false.


setDiscardQueuedTasksOnShutdown

public void setDiscardQueuedTasksOnShutdown(boolean discardTasks)
DiscardQueuedTasksOnShutdown tells the thread pool whether or not to wait for queued tasks to complete execution when the service is stopped. Defaults to false.



Copyright 1999-2003 Sapient Corporation. All Rights Reserved.