org.apache.cocoon.components.thread
Interface ThreadPool

All Known Implementing Classes:
DefaultThreadPool

public interface ThreadPool

The ThreadPool interface gives access to methods needed to inspect and use of a pool of threads

Version:
CVS $Id: ThreadPool.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Giacomo Pati

Field Summary
static String POLICY_ABORT
          ThreadPool block policy ABORT
static String POLICY_DISCARD
          ThreadPool block policy DISCARD
static String POLICY_DISCARD_OLDEST
          ThreadPool block policy DISCARD-OLDEST
static String POLICY_RUN
          ThreadPool block policy RUN
static String POLICY_WAIT
          ThreadPool block policy WAIT
static String ROLE
          The Role name
 
Method Summary
 void execute(Runnable command)
          Execute a command using this pool
 String getBlockPolicy()
          The blocking policy used
 long getKeepAliveTime()
          How long will a thread in this pool be idle before it is allowed to be garbage collected
 int getMaximumPoolSize()
          How many threads are in this pool at maximum
 int getMaximumQueueSize()
          Maximum size of the queue
 int getMinimumPoolSize()
          How many threads are in this pool at minimum
 String getName()
          The Name of this thread pool
 int getPoolSize()
          How many threads are currently in this pool
 int getPriority()
          Get the thread priority used by this pool
 int getQueueSize()
          Current size of the queue.
 boolean isQueued()
          Whether this ThreadPool has a queue
 boolean isTerminatedAfterShutdown()
          Returns true if a shutDown method has succeeded in terminating all threads
 void shutdown()
          Terminates all threads possibly awaiting processing all elements currently in queue.
 

Field Detail

POLICY_ABORT

static final String POLICY_ABORT
ThreadPool block policy ABORT

See Also:
Constant Field Values

POLICY_DISCARD

static final String POLICY_DISCARD
ThreadPool block policy DISCARD

See Also:
Constant Field Values

POLICY_DISCARD_OLDEST

static final String POLICY_DISCARD_OLDEST
ThreadPool block policy DISCARD-OLDEST

See Also:
Constant Field Values

POLICY_RUN

static final String POLICY_RUN
ThreadPool block policy RUN

See Also:
Constant Field Values

POLICY_WAIT

static final String POLICY_WAIT
ThreadPool block policy WAIT

See Also:
Constant Field Values

ROLE

static final String ROLE
The Role name

Method Detail

getBlockPolicy

String getBlockPolicy()
The blocking policy used

Returns:
DOCUMENT ME!

getKeepAliveTime

long getKeepAliveTime()
How long will a thread in this pool be idle before it is allowed to be garbage collected

Returns:
maximum idle time

getMaximumPoolSize

int getMaximumPoolSize()
How many threads are in this pool at maximum

Returns:
maximum size of pool

getMaximumQueueSize

int getMaximumQueueSize()
Maximum size of the queue

Returns:
current size of queue

getMinimumPoolSize

int getMinimumPoolSize()
How many threads are in this pool at minimum

Returns:
minimum size of pool

getName

String getName()
The Name of this thread pool

Returns:
The name

getPoolSize

int getPoolSize()
How many threads are currently in this pool

Returns:
current size of pool

getPriority

int getPriority()
Get the thread priority used by this pool

Returns:
current size of queue

getQueueSize

int getQueueSize()
Current size of the queue.

Returns:
current size of queue. If the size of the queue is not maintained by an implementation -1 should be returned.

isQueued

boolean isQueued()
Whether this ThreadPool has a queue

Returns:
Returns true if this ThreadPool has a queue

isTerminatedAfterShutdown

boolean isTerminatedAfterShutdown()
Returns true if a shutDown method has succeeded in terminating all threads

Returns:
Whether a shutDown method has succeeded in terminating all threads

execute

void execute(Runnable command)
             throws InterruptedException
Execute a command using this pool

Parameters:
command - a Runnable to execute
Throws:
InterruptedException - In case of interruption

shutdown

void shutdown()
Terminates all threads possibly awaiting processing all elements currently in queue.



Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.