Interface TimerPersistence
- All Known Implementing Classes:
DatabaseTimerPersistence,FileTimerPersistence
public interface TimerPersistence
- Author:
- Stuart Douglas
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceListener that gets invoked when a new timer is added to the underlying store. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled when a timer is being persisted.loadActiveTimers(String timedObjectId, TimerServiceImpl timerService) Load all active timers for the given object.voidpersistTimer(TimerImpl timer) Called when a timer is being persistedregisterChangeListener(String timedObjectId, TimerPersistence.TimerChangeListener listener) Registers a listener to listed for new timers that are added to the database.booleanInvoked before running a timer in order to determine if this node should run the timer.default voidtimerDeployed(String timedObjectId) Signals that the timer is being deployed and any internal structured required should be added.voidtimerUndeployed(String timedObjectId) Signals that a timer is being undeployed, and all cached data relating to this object should be dropped to prevent a class loader leak
-
Field Details
-
SERVICE_NAME
static final org.jboss.msc.service.ServiceName SERVICE_NAME
-
-
Method Details
-
addTimer
Called when a timer is being persisted. In a clustered environment, if an auto timer has already been persisted by another concurrent node, it should not be persisted again, and its state should be set toCANCELED.- Parameters:
timer- The timer
-
persistTimer
Called when a timer is being persisted- Parameters:
timer- The timer
-
shouldRun
Invoked before running a timer in order to determine if this node should run the timer.- Parameters:
timer- The timer- Returns:
- true if the timer should be run
-
timerDeployed
Signals that the timer is being deployed and any internal structured required should be added.- Parameters:
timedObjectId-
-
timerUndeployed
Signals that a timer is being undeployed, and all cached data relating to this object should be dropped to prevent a class loader leak- Parameters:
timedObjectId-
-
loadActiveTimers
Load all active timers for the given object. If the object is an entity bean timers for all beans will be returned.- Parameters:
timedObjectId- The timed object id to load timers for- Returns:
- A list of all active timers
-
registerChangeListener
Closeable registerChangeListener(String timedObjectId, TimerPersistence.TimerChangeListener listener) Registers a listener to listed for new timers that are added to the database.- Parameters:
timedObjectId- The timed objectlistener- The listener- Returns:
- A Closable that can be used to unregister the listener
-