|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.thread.impl.DefaultRunnableManager
The DefaultRunnableManager implements the RunnableManager
interface
and is responsible to create ThreadPool
s and run Runnable
s
in them as background commands.
The configuration of the DefaultRunnableManager
:
<property name="workerThreadPools"> <configurator:bean-map type="org.apache.cocoon.thread.ThreadPool" strip-prefix="true"/> </property>
Field Summary | |
protected SortedSet |
commandStack
Sorted set of ExecutionInfo instances, based on their next
execution time. |
Fields inherited from interface org.apache.cocoon.thread.RunnableManager |
ROLE |
Constructor Summary | |
DefaultRunnableManager()
|
Method Summary | |
org.apache.cocoon.thread.ThreadPool |
createPool(int queueSize,
int maxPoolSize,
int minPoolSize,
int priority,
boolean isDaemon,
long keepAliveTime,
String blockPolicy,
boolean shutdownGraceful,
int shutdownWaitTime)
Create a private ThreadPool |
org.apache.cocoon.thread.ThreadPool |
createPool(String name,
int queueSize,
int maxPoolSize,
int minPoolSize,
int priority,
boolean isDaemon,
long keepAliveTime,
String blockPolicy,
boolean shutdownGraceful,
int shutdownWaitTimeMs)
Create a shared ThreadPool |
void |
destroy()
Destroy |
void |
execute(Runnable command)
Run a Runnable in the background using a ThreadPool |
void |
execute(Runnable command,
long delay)
Run a Runnable in the background using a ThreadPool |
void |
execute(Runnable command,
long delay,
long interval)
Run a Runnable in the background using a ThreadPool |
void |
execute(String threadPoolName,
Runnable command)
Run a Runnable in the background using a ThreadPool |
void |
execute(String threadPoolName,
Runnable command,
long delay)
Run a Runnable in the background using a ThreadPool |
void |
execute(String threadPoolName,
Runnable command,
long delay,
long interval)
Run a Runnable in the background using a ThreadPool |
Log |
getLogger()
|
org.apache.cocoon.thread.ThreadPool |
getPool(String name)
|
void |
init()
Initialize |
void |
remove(Runnable command)
Remove a Runnable from the command stack |
void |
run()
The heart of the command manager |
void |
setLogger(Log l)
|
void |
setWorkerThreadPools(Map workerThreadPools)
|
protected void |
start()
Start the managing thread |
protected void |
stop()
Stop the managing thread |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected SortedSet commandStack
ExecutionInfo
instances, based on their next
execution time.
Constructor Detail |
public DefaultRunnableManager()
Method Detail |
public Log getLogger()
public void setLogger(Log l)
public void init() throws Exception
Exception
public org.apache.cocoon.thread.ThreadPool createPool(String name, int queueSize, int maxPoolSize, int minPoolSize, int priority, boolean isDaemon, long keepAliveTime, String blockPolicy, boolean shutdownGraceful, int shutdownWaitTimeMs)
createPool
in interface org.apache.cocoon.thread.RunnableManager
name
- The name of the thread poolqueueSize
- The size of the queuemaxPoolSize
- The maximum number of threadsminPoolSize
- The maximum number of threadspriority
- The priority of threads created by this pool. This is one of
Thread.MIN_PRIORITY
, Thread.NORM_PRIORITY
,
or Thread.MAX_PRIORITY
isDaemon
- Whether or not thread from the pool should run in daemon modekeepAliveTime
- How long should a thread be alive for new work to be done
before it is GCedblockPolicy
- What's the blocking policy is resources are exhaustedshutdownGraceful
- Should we wait for the queue to finish all pending commands?
IllegalArgumentException
- If the pool already existspublic org.apache.cocoon.thread.ThreadPool createPool(int queueSize, int maxPoolSize, int minPoolSize, int priority, boolean isDaemon, long keepAliveTime, String blockPolicy, boolean shutdownGraceful, int shutdownWaitTime)
createPool
in interface org.apache.cocoon.thread.RunnableManager
queueSize
- The size of the queuemaxPoolSize
- The maximum number of threadsminPoolSize
- The maximum number of threadspriority
- The priority of threads created by this pool. This is one of
Thread.MIN_PRIORITY
, Thread.NORM_PRIORITY
,
or Thread.MAX_PRIORITY
isDaemon
- Whether or not thread from the pool should run in daemon modekeepAliveTime
- How long should a thread be alive for new work to be done
before it is GCedblockPolicy
- What's the blocking policy is resources are exhaustedshutdownGraceful
- Should we wait for the queue to finish all pending commands?shutdownWaitTime
- After what time a normal shutdown should take into account if
a graceful shutdown has not come to an end
ThreadPool
public org.apache.cocoon.thread.ThreadPool getPool(String name)
getPool
in interface org.apache.cocoon.thread.RunnableManager
RunnableManager.getPool(java.lang.String)
public void destroy() throws Exception
Exception
public void execute(String threadPoolName, Runnable command, long delay, long interval)
Runnable
in the background using a ThreadPool
execute
in interface org.apache.cocoon.thread.RunnableManager
threadPoolName
- The thread pool name to be usedcommand
- The Runnable
to executedelay
- the delay befor first runinterval
- The interval for repeated runs
IllegalArgumentException
- DOCUMENT ME!public void execute(Runnable command, long delay, long interval)
Runnable
in the background using a ThreadPool
execute
in interface org.apache.cocoon.thread.RunnableManager
command
- The Runnable
to executedelay
- the delay befor first runinterval
- The interval for repeated runspublic void execute(Runnable command, long delay)
Runnable
in the background using a ThreadPool
execute
in interface org.apache.cocoon.thread.RunnableManager
command
- The Runnable
to executedelay
- the delay befor first runpublic void execute(Runnable command)
Runnable
in the background using a ThreadPool
execute
in interface org.apache.cocoon.thread.RunnableManager
command
- The Runnable
to executepublic void execute(String threadPoolName, Runnable command, long delay)
Runnable
in the background using a ThreadPool
execute
in interface org.apache.cocoon.thread.RunnableManager
threadPoolName
- The thread pool name to be usedcommand
- The Runnable
to executedelay
- the delay befor first runpublic void execute(String threadPoolName, Runnable command)
Runnable
in the background using a ThreadPool
execute
in interface org.apache.cocoon.thread.RunnableManager
threadPoolName
- The thread pool name to be usedcommand
- The Runnable
to executepublic void remove(Runnable command)
Runnable
from the command stack
remove
in interface org.apache.cocoon.thread.RunnableManager
command
- The Runnable
to be removedpublic void run()
run
in interface Runnable
protected void start() throws Exception
Exception
- DOCUMENT ME!protected void stop()
public void setWorkerThreadPools(Map workerThreadPools)
workerThreadPools
- the workerThreadPools to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |