public class DatabaseTimerPersistence extends Object implements TimerPersistence, org.jboss.msc.service.Service<DatabaseTimerPersistence>
Database timer persistence store.
TimerPersistence.TimerChangeListener
SERVICE_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<ManagedReferenceFactory> |
getDataSourceInjectedValue() |
org.jboss.msc.value.InjectedValue<org.jboss.modules.ModuleLoader> |
getModuleLoader() |
org.jboss.msc.value.InjectedValue<Timer> |
getTimerInjectedValue() |
DatabaseTimerPersistence |
getValue() |
List<TimerImpl> |
loadActiveTimers(String timedObjectId,
TimerServiceImpl timerService)
Load all active timers for the given object.
|
void |
persistTimer(TimerImpl timerEntity)
Called when a timer is being persisted
|
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,
TransactionManager tm)
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 |
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.service.Service<DatabaseTimerPersistence>
org.jboss.msc.service.StartException
public void stop(org.jboss.msc.service.StopContext context)
stop
in interface org.jboss.msc.service.Service<DatabaseTimerPersistence>
public void addTimer(TimerImpl timerEntity)
TimerPersistence
addTimer
in interface TimerPersistence
timerEntity
- The timerpublic void persistTimer(TimerImpl timerEntity)
TimerPersistence
persistTimer
in interface TimerPersistence
timerEntity
- The timerpublic boolean shouldRun(TimerImpl timer, TransactionManager tm)
TimerPersistence
shouldRun
in interface TimerPersistence
timer
- The timertm
- Transaction manager to be able to create a transactionpublic void timerUndeployed(String timedObjectId)
TimerPersistence
timerUndeployed
in interface TimerPersistence
public List<TimerImpl> loadActiveTimers(String timedObjectId, TimerServiceImpl timerService)
TimerPersistence
loadActiveTimers
in interface TimerPersistence
timedObjectId
- The timed object id to load timers forpublic Closeable registerChangeListener(String timedObjectId, TimerPersistence.TimerChangeListener listener)
TimerPersistence
registerChangeListener
in interface TimerPersistence
timedObjectId
- The timed objectlistener
- The listenerpublic DatabaseTimerPersistence getValue() throws IllegalStateException, IllegalArgumentException
getValue
in interface org.jboss.msc.value.Value<DatabaseTimerPersistence>
IllegalStateException
IllegalArgumentException
public Object deSerialize(String data) throws SQLException
SQLException
public org.jboss.msc.value.InjectedValue<ManagedReferenceFactory> getDataSourceInjectedValue()
public org.jboss.msc.value.InjectedValue<org.jboss.modules.ModuleLoader> getModuleLoader()
public org.jboss.msc.value.InjectedValue<Timer> getTimerInjectedValue()
Copyright © 2016 JBoss by Red Hat. All rights reserved.