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:
$Id: ThreadPool.java 312843 2005-10-11 09:12:58Z cziegeler $
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

public static final String POLICY_ABORT
ThreadPool block policy ABORT

See Also:
Constant Field Values

POLICY_DISCARD

public static final String POLICY_DISCARD
ThreadPool block policy DISCARD

See Also:
Constant Field Values

POLICY_DISCARD_OLDEST

public static final String POLICY_DISCARD_OLDEST
ThreadPool block policy DISCARD-OLDEST

See Also:
Constant Field Values

POLICY_RUN

public static final String POLICY_RUN
ThreadPool block policy RUN

See Also:
Constant Field Values

POLICY_WAIT

public static final String POLICY_WAIT
ThreadPool block policy WAIT

See Also:
Constant Field Values

ROLE

public static final String ROLE
The Role name

Method Detail

getBlockPolicy

public String getBlockPolicy()
The blocking policy used

Returns:
DOCUMENT ME!

getKeepAliveTime

public 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

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

Returns:
maximum size of pool

getMaximumQueueSize

public int getMaximumQueueSize()
Maximum size of the queue

Returns:
current size of queue

getMinimumPoolSize

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

Returns:
minimum size of pool

getName

public String getName()
The Name of this thread pool

Returns:
The name

getPoolSize

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

Returns:
current size of pool

getPriority

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

Returns:
current size of queue

getQueueSize

public 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

public boolean isQueued()
Whether this ThreadPool has a queue

Returns:
Returns true if this ThreadPool has a queue

isTerminatedAfterShutdown

public 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

public 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

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



Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.