|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.quartz.simpl.ZeroSizeThreadPool
public class ZeroSizeThreadPool
This is class is a simple implementation of a zero size thread pool, based on the
interface.
ThreadPool
The pool has zero Thread
s and does not grow or shrink based on demand.
Which means it is obviously not useful for most scenarios. When it may be useful
is to prevent creating any worker threads at all - which may be desirable for
the sole purpose of preserving system resources in the case where the scheduler
instance only exists in order to schedule jobs, but which will never execute
jobs (e.g. will never have start() called on it).
Constructor Summary | |
---|---|
ZeroSizeThreadPool()
Create a new ZeroSizeThreadPool . |
Method Summary | |
---|---|
int |
blockForAvailableThreads()
Determines the number of threads that are currently available in in the pool. |
org.slf4j.Logger |
getLog()
|
int |
getPoolSize()
Get the current number of threads in the ThreadPool . |
void |
initialize()
Must be called before the ThreadPool is
used, in order to give the it a chance to initialize. |
boolean |
runInThread(java.lang.Runnable runnable)
Execute the given in the next
available Thread . |
void |
setInstanceId(java.lang.String schedInstId)
Inform the ThreadPool of the Scheduler instance's Id,
prior to initialize being invoked. |
void |
setInstanceName(java.lang.String schedName)
Inform the ThreadPool of the Scheduler instance's name,
prior to initialize being invoked. |
void |
shutdown()
|
void |
shutdown(boolean waitForJobsToComplete)
Called by the QuartzScheduler to inform the ThreadPool
that it should free up all of it's resources because the scheduler is
shutting down. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ZeroSizeThreadPool()
Create a new ZeroSizeThreadPool
.
Method Detail |
---|
public org.slf4j.Logger getLog()
public int getPoolSize()
ThreadPool
Get the current number of threads in the ThreadPool
.
getPoolSize
in interface ThreadPool
public void initialize() throws SchedulerConfigException
ThreadPool
Must be called before the ThreadPool
is
used, in order to give the it a chance to initialize.
Typically called by the SchedulerFactory
.
initialize
in interface ThreadPool
SchedulerConfigException
public void shutdown()
public void shutdown(boolean waitForJobsToComplete)
ThreadPool
Called by the QuartzScheduler to inform the ThreadPool
that it should free up all of it's resources because the scheduler is
shutting down.
shutdown
in interface ThreadPool
public boolean runInThread(java.lang.Runnable runnable)
ThreadPool
Execute the given
in the next
available Runnable
Thread
.
The implementation of this interface should not throw exceptions unless
there is a serious problem (i.e. a serious misconfiguration). If there
are no immediately available threads false
should be returned.
runInThread
in interface ThreadPool
public int blockForAvailableThreads()
ThreadPool
Determines the number of threads that are currently available in in
the pool. Useful for determining the number of times
runInThread(Runnable)
can be called before returning
false.
The implementation of this method should block until there is at least one available thread.
blockForAvailableThreads
in interface ThreadPool
public void setInstanceId(java.lang.String schedInstId)
ThreadPool
Inform the ThreadPool
of the Scheduler instance's Id,
prior to initialize being invoked.
setInstanceId
in interface ThreadPool
public void setInstanceName(java.lang.String schedName)
ThreadPool
Inform the ThreadPool
of the Scheduler instance's name,
prior to initialize being invoked.
setInstanceName
in interface ThreadPool
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |