Interface TimerPersistence
-
- All Known Implementing Classes:
DatabaseTimerPersistence,FileTimerPersistence
public interface TimerPersistence- Author:
- Stuart Douglas
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceTimerPersistence.TimerChangeListenerListener that gets invoked when a new timer is added to the underlying store.
-
Field Summary
Fields Modifier and Type Field Description static org.jboss.msc.service.ServiceNameSERVICE_NAME
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddTimer(TimerImpl timer)Called when a timer is being persisted.List<TimerImpl>loadActiveTimers(String timedObjectId, TimerServiceImpl timerService)Load all active timers for the given object.voidpersistTimer(TimerImpl timer)Called when a timer is being persistedCloseableregisterChangeListener(String timedObjectId, TimerPersistence.TimerChangeListener listener)Registers a listener to listed for new timers that are added to the database.booleanshouldRun(TimerImpl timer)Invoked 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
-
-
-
Method Detail
-
addTimer
void addTimer(TimerImpl timer)
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
void persistTimer(TimerImpl timer)
Called when a timer is being persisted- Parameters:
timer- The timer
-
shouldRun
boolean shouldRun(TimerImpl timer)
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
default void timerDeployed(String timedObjectId)
Signals that the timer is being deployed and any internal structured required should be added.- Parameters:
timedObjectId-
-
timerUndeployed
void timerUndeployed(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- Parameters:
timedObjectId-
-
loadActiveTimers
List<TimerImpl> loadActiveTimers(String timedObjectId, TimerServiceImpl timerService)
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
-
-