public class DatabaseTimerPersistence extends Object implements TimerPersistence, org.jboss.msc.service.Service<DatabaseTimerPersistence>
Database timer persistence store.
TimerPersistence.TimerChangeListenerSERVICE_NAME| Constructor and Description |
|---|
DatabaseTimerPersistence(String database,
String partition,
String nodeName,
int refreshInterval,
boolean allowExecution) |
| Modifier and Type | Method and Description |
|---|---|
void |
addTimer(TimerImpl timerEntity)
Called when a timer is being persisted.
|
Object |
deSerialize(String data) |
org.jboss.msc.value.InjectedValue<org.jboss.as.naming.ManagedReferenceFactory> |
getDataSourceInjectedValue() |
org.jboss.msc.value.InjectedValue<org.jboss.modules.ModuleLoader> |
getModuleLoader() |
Serializable |
getPersistedTimerInfo(TimerImpl timer)
Retrieves the timer info from the timer database.
|
org.jboss.msc.value.InjectedValue<Timer> |
getTimerInjectedValue() |
DatabaseTimerPersistence |
getValue() |
List<TimerImpl> |
loadActiveTimers(String timedObjectId,
TimerServiceImpl timerService)
Load all active timers for the given object.
|
TimerImpl |
loadTimer(String timedObjectId,
String timerId,
TimerServiceImpl timerService)
Loads a timer from database by its id and timed object id.
|
void |
persistTimer(TimerImpl timerEntity)
Called when a timer is being persisted
|
void |
refreshTimers() |
Closeable |
registerChangeListener(String timedObjectId,
TimerPersistence.TimerChangeListener listener)
Registers a listener to listed for new timers that are added to the database.
|
boolean |
shouldRun(TimerImpl timer)
Invoked before running a timer in order to determine if this node should run the timer.
|
void |
start(org.jboss.msc.service.StartContext context) |
void |
stop(org.jboss.msc.service.StopContext context) |
void |
timerDeployed(String timedObjectId)
Signals that the timer is being deployed and any internal structured required should be added.
|
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
|
public void start(org.jboss.msc.service.StartContext context)
throws org.jboss.msc.service.StartException
start in interface org.jboss.msc.Serviceorg.jboss.msc.service.StartExceptionpublic void stop(org.jboss.msc.service.StopContext context)
stop in interface org.jboss.msc.Servicepublic TimerImpl loadTimer(String timedObjectId, String timerId, TimerServiceImpl timerService)
timedObjectId - the timed object id for the timertimerId - the timer idtimerService - the active timer servicepublic void addTimer(TimerImpl timerEntity)
TimerPersistenceCANCELED.addTimer in interface TimerPersistencetimerEntity - The timerpublic void persistTimer(TimerImpl timerEntity)
TimerPersistencepersistTimer in interface TimerPersistencetimerEntity - The timerpublic boolean shouldRun(TimerImpl timer)
TimerPersistenceshouldRun in interface TimerPersistencetimer - The timerpublic void timerUndeployed(String timedObjectId)
TimerPersistencetimerUndeployed in interface TimerPersistencepublic void timerDeployed(String timedObjectId)
TimerPersistencetimerDeployed in interface TimerPersistencepublic List<TimerImpl> loadActiveTimers(String timedObjectId, TimerServiceImpl timerService)
TimerPersistenceloadActiveTimers in interface TimerPersistencetimedObjectId - The timed object id to load timers forpublic Closeable registerChangeListener(String timedObjectId, TimerPersistence.TimerChangeListener listener)
TimerPersistenceregisterChangeListener in interface TimerPersistencetimedObjectId - The timed objectlistener - The listenerpublic DatabaseTimerPersistence getValue() throws IllegalStateException, IllegalArgumentException
getValue in interface org.jboss.msc.value.Value<DatabaseTimerPersistence>IllegalStateExceptionIllegalArgumentExceptionpublic void refreshTimers()
public Serializable getPersistedTimerInfo(TimerImpl timer)
timer - the timer whose info to be retrievedSQLExceptionpublic Object deSerialize(String data) throws SQLException
SQLExceptionpublic org.jboss.msc.value.InjectedValue<org.jboss.as.naming.ManagedReferenceFactory> getDataSourceInjectedValue()
public org.jboss.msc.value.InjectedValue<org.jboss.modules.ModuleLoader> getModuleLoader()
public org.jboss.msc.value.InjectedValue<Timer> getTimerInjectedValue()
Copyright © 2022 JBoss by Red Hat. All rights reserved.