|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectEDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
EDU.oswego.cs.dl.util.concurrent.PooledExecutor
org.apache.cocoon.thread.impl.DefaultThreadPool
The DefaultThreadPool class implements the ThreadPool interface.
Instances of this class are made by the RunnableManager passing a
threadpool into the init method.
<!--+
| More indepth information can be found at
| http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/PooledExecutor.html
| The following elements can be used:
+-->
<!-- required name of the pool -->
<property name="name" value="default" />
<!--+
| optional priority all threads of the pool will have (the ThreadFactory will be
| set to this priority).The possible values are:
| MIN: corresponds to Thread#MIN_PRIORITY
| NORM: corresponds to Thread#NORM_PRIORITY (default)
| MAX: corresponds to Thread#MAX_PRIORITY
+-->
<property name="poolPriority" value="NORM" />
<!--+
| whether newly created Threads should run in daemon mode or not. Default to false.
+-->
<property name="daemon" value="false" />
<!--+
| optional size of a queue to hold Runnables if the pool is full. Possible values are:
| less than 0: unbounded (default)
| equal to 0: no queue at all
| greater than 0: size of the queue
-->
<property name="queueSize" value="-1" />
<!--+
| optional maximum number of threads in the pool. Defaults to 5.
| NOTE: if a queue is specified (queue-sie != 0)
| this value will be ignored.
+-->
<property name="maxPoolSize" value="5" />
<!--+
| optional minimum number of threads in the pool. Defaults to 5.
| NOTE: if a queue has been specified (queue-sie != 0)
| this value will be used as the maximum of thread running concurrently.
+-->
<property name="minPoolSize" value="5" />
<!--+
| The time in ms an idle thread should keep alive before it might get garbage collected.
| This defaults to 60000 ms.
+-->
<property name="keepAliveTime" value="60000" />
<!--+
| The policy to be used if all resources (thread in the pool and
| slots in the queue) are exhausted.
| Possible values are:
| ABORT: Throw a RuntimeException
| DISCARD: Throw away the current request and return.
| DISCARDOLDEST: Throw away the oldest request and return.
| RUN (default): The thread making the execute request runs the task itself.
| This policy helps guard against lockup.
| WAIT: Wait until a thread becomes available. This policy should, in
| general, not be used if the minimum number of threads is zero,
| in which case a thread may never become available.
+-->
<property name="blockPolicy" value="ABORT" />
<!--+
| Terminate thread pool after processing all Runnables currently in queue. Any
| Runnable entered after this point will be discarded. A shut down pool cannot
| be restarted. This also means that a pool will need keep-alive-time-ms to
| terminate. The default value not to shutdown graceful.
+-->
<property name="shutdownGraceful" value="false" />
<!--+
| The time in ms to wait before issuing an immediate shutdown after a graceful shutdown
| has been requested.
+-->
<property name="shutdownWaitTimeMs" value="-1" />
<!--+
| specifies the fully qualified class name of an org.apache.cocoon.thread.ThreadFactory
| implementation. It is responsible to create Thread classes.
+-->
<property name="factory" ref="defaultThreadFactory"/>
| Nested Class Summary |
| Nested classes inherited from class EDU.oswego.cs.dl.util.concurrent.PooledExecutor |
EDU.oswego.cs.dl.util.concurrent.PooledExecutor.AbortWhenBlocked, EDU.oswego.cs.dl.util.concurrent.PooledExecutor.BlockedExecutionHandler, EDU.oswego.cs.dl.util.concurrent.PooledExecutor.DiscardOldestWhenBlocked, EDU.oswego.cs.dl.util.concurrent.PooledExecutor.DiscardWhenBlocked, EDU.oswego.cs.dl.util.concurrent.PooledExecutor.RunWhenBlocked, EDU.oswego.cs.dl.util.concurrent.PooledExecutor.WaitWhenBlocked, EDU.oswego.cs.dl.util.concurrent.PooledExecutor.Worker |
| Nested classes inherited from class EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser |
EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser.DefaultThreadFactory |
| Field Summary | |
protected Log |
logger
By default we use the logger for this class. |
static String |
POLICY_DEFAULT
Default ThreadPool block policy |
| Fields inherited from class EDU.oswego.cs.dl.util.concurrent.PooledExecutor |
blockedExecutionHandler_, DEFAULT_KEEPALIVETIME, DEFAULT_MAXIMUMPOOLSIZE, DEFAULT_MINIMUMPOOLSIZE, handOff_, keepAliveTime_, maximumPoolSize_, minimumPoolSize_, poolSize_, shutdown_, threads_ |
| Fields inherited from class EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser |
threadFactory_ |
| Fields inherited from interface org.apache.cocoon.thread.ThreadPool |
DEFAULT_BLOCK_POLICY, DEFAULT_DAEMON_MODE, DEFAULT_KEEP_ALIVE_TIME, DEFAULT_MAX_POOL_SIZE, DEFAULT_MIN_POOL_SIZE, DEFAULT_QUEUE_SIZE, DEFAULT_SHUTDOWN_GRACEFUL, DEFAULT_SHUTDOWN_WAIT_TIME, DEFAULT_THREAD_PRIORITY, DEFAULT_THREADPOOL_NAME, POLICY_ABORT, POLICY_DISCARD, POLICY_DISCARD_OLDEST, POLICY_RUN, POLICY_WAIT, ROLE |
| Method Summary | |
void |
execute(Runnable command)
Execute a command |
String |
getBlockPolicy()
Get the block policy |
org.apache.cocoon.thread.ThreadFactory |
getFactory()
|
long |
getKeepAliveTime()
|
int |
getMaxPoolSize()
|
int |
getMaxQueueSize()
DOCUMENT ME! |
int |
getMinPoolSize()
|
String |
getName()
|
int |
getPriority()
Get hte priority used to create Threads |
int |
getQueueSize()
DOCUMENT ME! |
int |
getShutdownWaitTimeMs()
DOCUMENT ME! |
void |
init()
Initialize the bean after properties set |
boolean |
isDaemon()
Returns true if thread runs as daemon |
boolean |
isQueued()
Whether this DefaultThreadPool has a queue |
boolean |
isShutdownGraceful()
DOCUMENT ME! |
void |
setBlockPolicy(String blockPolicy)
Set the blocking policy |
void |
setDaemon(boolean daemon)
Set to true if thread shall run as daemon |
void |
setFactory(org.apache.cocoon.thread.ThreadFactory factory)
|
void |
setKeepAliveTime(long keepAliveTime)
|
void |
setMaxPoolSize(int maxPoolSize)
|
void |
setMinPoolSize(int minPoolSize)
|
void |
setName(String name)
DOCUMENT ME! |
void |
setPoolPriority(String poolPriority)
|
void |
setPriority(int priority)
|
void |
setQueueSize(int queueSize)
Sets the queue size of the thread pool |
void |
setShutdownGraceful(boolean shutdownGraceful)
DOCUMENT ME! |
void |
setShutdownWaitTimeMs(int shutdownWaitTimeMs)
DOCUMENT ME! |
void |
shutdown()
|
String |
toString()
Overwrite the toString method |
| Methods inherited from class EDU.oswego.cs.dl.util.concurrent.PooledExecutor |
abortWhenBlocked, addThread, awaitTerminationAfterShutdown, awaitTerminationAfterShutdown, createThreads, discardOldestWhenBlocked, discardWhenBlocked, drain, getBlockedExecutionHandler, getMaximumPoolSize, getMinimumPoolSize, getPoolSize, getTask, interruptAll, isTerminatedAfterShutdown, runWhenBlocked, setBlockedExecutionHandler, setMaximumPoolSize, setMinimumPoolSize, shutdownAfterProcessingCurrentlyQueuedTasks, shutdownAfterProcessingCurrentlyQueuedTasks, shutdownNow, shutdownNow, waitWhenBlocked, workerDone |
| Methods inherited from class EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser |
getThreadFactory, setThreadFactory |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.apache.cocoon.thread.ThreadPool |
isTerminatedAfterShutdown |
| Field Detail |
public static final String POLICY_DEFAULT
protected final Log logger
| Method Detail |
public void init()
throws IllegalArgumentException
IllegalArgumentExceptionpublic String getBlockPolicy()
getBlockPolicy in interface org.apache.cocoon.thread.ThreadPoolpublic int getMaxQueueSize()
getMaxQueueSize in interface org.apache.cocoon.thread.ThreadPoolThreadPool.getQueueSize()public String getName()
getName in interface org.apache.cocoon.thread.ThreadPoolThreadPool.getName()public int getPriority()
getPriority in interface org.apache.cocoon.thread.ThreadPoolThread.MIN_PRIORITY, Thread.NORM_PRIORITY,
or Thread.MAX_PRIORITYpublic int getQueueSize()
getQueueSize in interface org.apache.cocoon.thread.ThreadPoolThreadPool.getQueueSize()public boolean isQueued()
isQueued in interface org.apache.cocoon.thread.ThreadPoolThreadPool.isQueued()
public void execute(Runnable command)
throws InterruptedException
execute in interface org.apache.cocoon.thread.ThreadPoolcommand - The Runnable to execute
InterruptedException - In case of interruptionpublic void shutdown()
org.apache.cocoon.thread.ThreadPool#shutdown()public void setBlockPolicy(String blockPolicy)
blockPolicy - The blocking policy valuepublic void setName(String name)
name - The name to set.public void setShutdownGraceful(boolean shutdownGraceful)
shutdownGraceful - The shutdownGraceful to set.public boolean isShutdownGraceful()
isShutdownGraceful in interface org.apache.cocoon.thread.ThreadPoolpublic void setShutdownWaitTimeMs(int shutdownWaitTimeMs)
shutdownWaitTimeMs - The shutdownWaitTimeMs to set.public int getShutdownWaitTimeMs()
getShutdownWaitTimeMs in interface org.apache.cocoon.thread.ThreadPoolpublic long getKeepAliveTime()
getKeepAliveTime in interface org.apache.cocoon.thread.ThreadPoolpublic void setKeepAliveTime(long keepAliveTime)
keepAliveTime - the keepAliveTime to setpublic int getMaxPoolSize()
getMaxPoolSize in interface org.apache.cocoon.thread.ThreadPoolpublic void setMaxPoolSize(int maxPoolSize)
maxPoolSize - the maxPoolSize to setpublic int getMinPoolSize()
getMinPoolSize in interface org.apache.cocoon.thread.ThreadPoolpublic void setMinPoolSize(int minPoolSize)
minPoolSize - the minPoolSize to setpublic org.apache.cocoon.thread.ThreadFactory getFactory()
public void setPriority(int priority)
priority - the priority to setpublic void setPoolPriority(String poolPriority)
public void setQueueSize(int queueSize)
queueSize - the queueSize to setpublic boolean isDaemon()
isDaemon in interface org.apache.cocoon.thread.ThreadPoolpublic void setDaemon(boolean daemon)
daemon - the daemon to setpublic String toString()
public void setFactory(org.apache.cocoon.thread.ThreadFactory factory)
factory - the factory to set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||