|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.avalon.framework.logger.AbstractLogEnabled org.apache.avalon.cornerstone.blocks.scheduler.DefaultTimeScheduler
Default implementation of TimeScheduler service.
Field Summary |
Fields inherited from interface org.apache.avalon.cornerstone.services.scheduler.TimeScheduler |
ROLE |
Constructor Summary | |
DefaultTimeScheduler()
|
Method Summary | |
void |
addTrigger(java.lang.String name,
TimeTrigger trigger,
Target target)
Schedule a time based trigger. |
void |
addTriggerFailureListener(TriggerFailureListener listener)
Add a trigger failure listener |
void |
dispose()
The dispose operation is called at the end of a components lifecycle. |
protected void |
doRunEntry(TimeScheduledEntry entry)
Helper method delegated to to run in a separate thread. |
java.util.Collection |
getEntries()
Return a collection of the triggerable names. |
protected TimeScheduledEntry |
getEntry(java.lang.String name)
Retrieve entry from set. |
protected java.util.Map |
getEntryMap()
|
protected TimeScheduledEntry |
getNextEntry()
Retrieve next valid entry. |
protected PriorityQueue |
getPriorityQueue()
|
protected ThreadManager |
getThreadManager()
|
protected java.util.List |
getTriggerFailureListeners()
|
protected boolean |
isRunning()
|
protected void |
notifyFailedTriggers(java.lang.Throwable t)
|
void |
removeTrigger(java.lang.String name)
Remove a scheduled trigger by name. |
void |
removeTriggerFailureListener(TriggerFailureListener listener)
Remove a trigger failure listener |
protected boolean |
rescheduleEntry(TimeScheduledEntry timeEntry,
boolean clone)
Reschedule an entry. |
void |
resetTrigger(java.lang.String name)
Force a trigger time to be recalculated. |
void |
run()
Entry point for thread that monitors entrys and triggers entrys when necessary. |
protected void |
runEntry(TimeScheduledEntry entry)
Run entry in a separate thread and reschedule it. |
void |
service(ServiceManager serviceManager)
Supply of the service manager to the component. |
protected void |
setRunning(boolean running)
|
void |
start()
Starts the component. |
void |
stop()
Stops the component. |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DefaultTimeScheduler()
Method Detail |
protected final ThreadManager getThreadManager()
protected final boolean isRunning()
protected final void setRunning(boolean running)
protected final java.util.List getTriggerFailureListeners()
protected final java.util.Map getEntryMap()
protected final PriorityQueue getPriorityQueue()
public void service(ServiceManager serviceManager) throws ServiceException
service
in interface Serviceable
serviceManager
- the service manager
ServiceException
- if an error occurspublic void dispose()
Disposable
dispose
in interface Disposable
public void start() throws java.lang.Exception
Startable
start
in interface Startable
java.lang.Exception
- if Component can not be startedpublic void stop()
Startable
stop
in interface Startable
public void run()
run
in interface java.lang.Runnable
public void addTriggerFailureListener(TriggerFailureListener listener)
addTriggerFailureListener
in interface TimeScheduler
listener
- The listenerpublic void removeTriggerFailureListener(TriggerFailureListener listener)
removeTriggerFailureListener
in interface TimeScheduler
listener
- The listenerpublic void addTrigger(java.lang.String name, TimeTrigger trigger, Target target)
addTrigger
in interface TimeScheduler
name
- the name of the triggertrigger
- the triggertarget
- the targetpublic void removeTrigger(java.lang.String name) throws java.util.NoSuchElementException
removeTrigger
in interface TimeScheduler
name
- the name of the trigger
java.util.NoSuchElementException
- if no trigger exists with that namepublic void resetTrigger(java.lang.String name) throws java.util.NoSuchElementException
resetTrigger
in interface TimeScheduler
name
- the name of the trigger
java.util.NoSuchElementException
- if no trigger exists with that namepublic java.util.Collection getEntries()
getEntries
in interface MonitorableTimeSchedulerMBean
protected boolean rescheduleEntry(TimeScheduledEntry timeEntry, boolean clone)
timeEntry
- the entryclone
- true if new entry is to be created
protected TimeScheduledEntry getEntry(java.lang.String name) throws java.util.NoSuchElementException
name
- the name of entry
java.util.NoSuchElementException
- if no entry is found with that nameprotected void runEntry(TimeScheduledEntry entry)
entry
- the entry to runprotected void doRunEntry(TimeScheduledEntry entry)
entry
- the entry to runprotected TimeScheduledEntry getNextEntry()
protected void notifyFailedTriggers(java.lang.Throwable t)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |