|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.exolab.core.service.Service | +--org.exolab.core.service.BasicService | +--org.exolab.jms.scheduler.Scheduler
The scheduler is responsible for executing Runnable
objects
using a thread pool. Clients can add these objects to the scheduler
and the scheduler will, in fifo order, execute them. If there are no
threads currently available, the runnable will wait for one to become
available.
A client can add or remove Runnable
objects.
Runnable
,
BasicService
,
ThreadPool
, Serialized FormMethod Summary | |
void |
add(java.lang.Runnable runner)
Add a Runnable object to the scheduler queue. |
boolean |
contains(java.lang.Runnable runner)
Returns if a Runnable object exists in the scheduler queue. |
static Scheduler |
createInstance()
Creates the singleton instance |
static Scheduler |
instance()
Returns the singleton instance |
boolean |
isEmpty()
Returns true if the scheduler queue is empty |
protected java.lang.Runnable |
next()
Return the next object in the queue to execute This method blocks until an object becomes available. |
boolean |
remove(java.lang.Runnable runner)
Remove a Runnable object from the scheduler queue. |
void |
run()
Start the scheduler This can only be terminated by invoking stop() |
void |
stop()
|
Methods inherited from class org.exolab.core.service.BasicService |
start, toString |
Methods inherited from class org.exolab.core.service.Service |
getName, getState, restart, setState |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
public static Scheduler createInstance() throws org.exolab.core.service.ServiceException
org.exolab.core.service.ServiceException
- if the scheduler can't be createdpublic static Scheduler instance()
null
if it hasn't
been initialisedpublic void add(java.lang.Runnable runner)
runner
- the object to executepublic boolean remove(java.lang.Runnable runner)
runner
- the object to removepublic boolean contains(java.lang.Runnable runner)
runner
- the object to removepublic boolean isEmpty()
public void run()
stop()
run
in class org.exolab.core.service.BasicService
public void stop() throws org.exolab.core.service.ServiceException
stop
in class org.exolab.core.service.BasicService
protected java.lang.Runnable next()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |