public class CmsSchedulerThreadPool extends java.lang.Object implements org.quartz.spi.ThreadPool
Constructor and Description |
---|
CmsSchedulerThreadPool()
Create a new
CmsSchedulerThreadPool with default values. |
CmsSchedulerThreadPool(int initialThreadCount,
int maxThreadCount,
int threadPriority)
Create a new
CmsSchedulerThreadPool with the specified number
of threads that have the given priority. |
Modifier and Type | Method and Description |
---|---|
int |
blockForAvailableThreads() |
protected java.lang.Runnable |
getNextRunnable()
Dequeue the next pending
Runnable . |
int |
getPoolSize() |
int |
getThreadPriority()
Returns the thread priority of the threads in the scheduler pool.
|
void |
initialize() |
boolean |
runInThread(java.lang.Runnable runnable)
Run the given
Runnable object in the next available
Thread . |
void |
shutdown()
Terminate any worker threads in this thread group.
|
void |
shutdown(boolean waitForJobsToComplete)
Terminate all threads in this thread group.
|
public CmsSchedulerThreadPool()
CmsSchedulerThreadPool
with default values.
This will create a pool with 0 initial and 10 maximum threads running
in normal priority.public CmsSchedulerThreadPool(int initialThreadCount, int maxThreadCount, int threadPriority)
CmsSchedulerThreadPool
with the specified number
of threads that have the given priority.
The OpenCms scheduler thread pool will initially start with provided number of
active scheduler threads.
When a thread is requested by the scheduler, and no "free" threads are available,
a new thread will be added to the pool and used for execution. The pool
will be allowed to grow until it has reached the configured number
of maximum threads.initialThreadCount
- the initial number of threads for the poolmaxThreadCount
- maximum number of threads the pool is allowed to growthreadPriority
- the thread priority for the scheduler threadsThread
public int blockForAvailableThreads()
ThreadPool
public int getPoolSize()
getPoolSize
in interface org.quartz.spi.ThreadPool
ThreadPool.getPoolSize()
public int getThreadPriority()
public void initialize() throws org.quartz.SchedulerConfigException
initialize
in interface org.quartz.spi.ThreadPool
org.quartz.SchedulerConfigException
ThreadPool.initialize()
public boolean runInThread(java.lang.Runnable runnable)
Runnable
object in the next available
Thread
.If while waiting the thread pool is asked to shut down, the Runnable is executed immediately within a new additional thread.
runInThread
in interface org.quartz.spi.ThreadPool
runnable
- the Runnable
to runRunnable
was runpublic void shutdown()
Jobs currently in progress will be allowed to complete.
public void shutdown(boolean waitForJobsToComplete)
shutdown
in interface org.quartz.spi.ThreadPool
waitForJobsToComplete
- if true,, all current jobs will be allowed to completeprotected java.lang.Runnable getNextRunnable() throws java.lang.InterruptedException
Runnable
.Runnable
java.lang.InterruptedException
- if something goes wrong