org.apache.cocoon.thread
Interface ThreadPool


public interface ThreadPool

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

Version:
$Id: ThreadPool.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Field Summary
static String DEFAULT_BLOCK_POLICY
          The default shutdown waittime time
static boolean DEFAULT_DAEMON_MODE
          The default daemon mode
static long DEFAULT_KEEP_ALIVE_TIME
          The default keep alive time
static int DEFAULT_MAX_POOL_SIZE
          The default maximum pool size
static int DEFAULT_MIN_POOL_SIZE
          The default minimum pool size
static int DEFAULT_QUEUE_SIZE
          The default queue size
static boolean DEFAULT_SHUTDOWN_GRACEFUL
          The default way to shutdown gracefully
static int DEFAULT_SHUTDOWN_WAIT_TIME
          The default shutdown waittime time
static String DEFAULT_THREAD_PRIORITY
          The default thread priority
static String DEFAULT_THREADPOOL_NAME
          The default shutdown waittime time
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
 String getBlockPolicy()
          Gets the block policy
 long getKeepAliveTime()
          Gets the keepAliveTime in milliseconds
 int getMaxPoolSize()
          Gets the maximum pool size
 int getMaxQueueSize()
          Gets the maximum queue size
 int getMinPoolSize()
          Gets the minimum pool size
 String getName()
          Gets the name of the thread pool
 int getPriority()
          Gets the priority used to create Threads
 int getQueueSize()
          Gets the queue size of the thread pool
 int getShutdownWaitTimeMs()
          Gets the shutdownWaitTime in milliseconds
 boolean isDaemon()
          Returns true if thread runs as daemon
 boolean isQueued()
          Whether this DefaultThreadPool has a queue
 boolean isShutdownGraceful()
          Returns true if shutdown is graceful
 boolean isTerminatedAfterShutdown()
          Returns true if a shutDown method has succeeded in terminating all threads
 

Field Detail

DEFAULT_QUEUE_SIZE

public static final int DEFAULT_QUEUE_SIZE
The default queue size

See Also:
Constant Field Values

DEFAULT_MAX_POOL_SIZE

public static final int DEFAULT_MAX_POOL_SIZE
The default maximum pool size

See Also:
Constant Field Values

DEFAULT_MIN_POOL_SIZE

public static final int DEFAULT_MIN_POOL_SIZE
The default minimum pool size

See Also:
Constant Field Values

DEFAULT_THREAD_PRIORITY

public static final String DEFAULT_THREAD_PRIORITY
The default thread priority

See Also:
Constant Field Values

DEFAULT_DAEMON_MODE

public static final boolean DEFAULT_DAEMON_MODE
The default daemon mode

See Also:
Constant Field Values

DEFAULT_KEEP_ALIVE_TIME

public static final long DEFAULT_KEEP_ALIVE_TIME
The default keep alive time

See Also:
Constant Field Values

DEFAULT_SHUTDOWN_GRACEFUL

public static final boolean DEFAULT_SHUTDOWN_GRACEFUL
The default way to shutdown gracefully

See Also:
Constant Field Values

DEFAULT_SHUTDOWN_WAIT_TIME

public static final int DEFAULT_SHUTDOWN_WAIT_TIME
The default shutdown waittime time

See Also:
Constant Field Values

DEFAULT_THREADPOOL_NAME

public static final String DEFAULT_THREADPOOL_NAME
The default shutdown waittime time

See Also:
Constant Field Values

DEFAULT_BLOCK_POLICY

public static final String DEFAULT_BLOCK_POLICY
The default shutdown waittime time

See Also:
Constant Field Values

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()
Gets the block policy

Returns:
Returns the blockPolicy.

getMaxQueueSize

public int getMaxQueueSize()
Gets the maximum queue size

Returns:
maximum size of the queue (0 if isQueued() == false)

getName

public String getName()
Gets the name of the thread pool

Returns:
name of the thread pool

getPriority

public int getPriority()
Gets the priority used to create Threads

Returns:
Thread.MIN_PRIORITY, Thread.NORM_PRIORITY, or Thread.MAX_PRIORITY

getQueueSize

public int getQueueSize()
Gets the queue size of the thread pool

Returns:
current size of the queue (0 if isQueued() == false)

isQueued

public boolean isQueued()
Whether this DefaultThreadPool has a queue

Returns:
Returns the m_isQueued.

execute

public void execute(Runnable command)
             throws InterruptedException
Execute a command

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

isShutdownGraceful

public boolean isShutdownGraceful()
Returns true if shutdown is graceful

Returns:
Returns the shutdownGraceful.

getShutdownWaitTimeMs

public int getShutdownWaitTimeMs()
Gets the shutdownWaitTime in milliseconds

Returns:
Returns the shutdownWaitTimeMs.

getKeepAliveTime

public long getKeepAliveTime()
Gets the keepAliveTime in milliseconds

Returns:
the keepAliveTime

getMaxPoolSize

public int getMaxPoolSize()
Gets the maximum pool size

Returns:
the maxPoolSize

getMinPoolSize

public int getMinPoolSize()
Gets the minimum pool size

Returns:
the minPoolSize

isDaemon

public boolean isDaemon()
Returns true if thread runs as daemon

Returns:
the daemon

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


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.