Class DynamicQuartzThreadPool

  • All Implemented Interfaces:
    org.quartz.spi.ThreadPool

    public class DynamicQuartzThreadPool
    extends Object
    implements org.quartz.spi.ThreadPool
    • Constructor Detail

      • DynamicQuartzThreadPool

        public DynamicQuartzThreadPool​(ThreadGroup threadGroup,
                                       String threadPoolName,
                                       String threadNameSuffix,
                                       int maxThreadCount,
                                       int threadPriority,
                                       Duration threadKeepAlive)

        Create a new SimpleThreadPool with the specified number of Thread s that have the given priority.

        Parameters:
        threadCount - the max number of worker Threads in the pool, must be > 0.
        threadPriority - the thread priority for the worker threads.
        See Also:
        Thread
    • Method Detail

      • runInThread

        public boolean runInThread​(Runnable runnable)

        Run the given 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.

        Specified by:
        runInThread in interface org.quartz.spi.ThreadPool
        Parameters:
        runnable - the Runnable to be added.
      • blockForAvailableThreads

        public int blockForAvailableThreads()
        Specified by:
        blockForAvailableThreads in interface org.quartz.spi.ThreadPool
      • getPoolSize

        public int getPoolSize()
        Specified by:
        getPoolSize in interface org.quartz.spi.ThreadPool
      • initialize

        public void initialize()
                        throws org.quartz.SchedulerConfigException
        Specified by:
        initialize in interface org.quartz.spi.ThreadPool
        Throws:
        org.quartz.SchedulerConfigException
      • startAllWorkersNow

        public void startAllWorkersNow()
      • shutdown

        public void shutdown​(boolean waitForJobsToComplete)
        Specified by:
        shutdown in interface org.quartz.spi.ThreadPool
      • getCurrentWorkerCount

        public int getCurrentWorkerCount()
      • getCurrentAvailableWorkerCount

        public int getCurrentAvailableWorkerCount()
      • getCurrentBusyWorkerCount

        public int getCurrentBusyWorkerCount()
      • setInstanceId

        public void setInstanceId​(String schedulerInstanceId)
        Specified by:
        setInstanceId in interface org.quartz.spi.ThreadPool
      • setInstanceName

        public void setInstanceName​(String schedulerInstanceName)
        Specified by:
        setInstanceName in interface org.quartz.spi.ThreadPool
      • createNewWorker

        protected com.floragunn.searchsupport.jobs.core.DynamicQuartzThreadPool.WorkerThread createNewWorker​(Runnable runnable)
      • makeAvailable

        protected void makeAvailable​(com.floragunn.searchsupport.jobs.core.DynamicQuartzThreadPool.WorkerThread workerThread)
      • onTermination

        protected void onTermination​(com.floragunn.searchsupport.jobs.core.DynamicQuartzThreadPool.WorkerThread workerThread)
      • getPollingIntervalMs

        public long getPollingIntervalMs()
      • setPollingIntervalMs

        public void setPollingIntervalMs​(long pollingIntervalMs)