Class FileTimerPersistence
- java.lang.Object
-
- org.jboss.as.ejb3.timerservice.persistence.filestore.FileTimerPersistence
-
- All Implemented Interfaces:
TimerPersistence,org.jboss.msc.Service
public class FileTimerPersistence extends Object implements TimerPersistence, org.jboss.msc.Service
File based persistent timer store. TODO: this is fairly hackey at the moment, it should be registered as an XA resource to support proper XA semantics- Author:
- Stuart Douglas
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jboss.as.ejb3.timerservice.persistence.TimerPersistence
TimerPersistence.TimerChangeListener
-
-
Field Summary
-
Fields inherited from interface org.jboss.as.ejb3.timerservice.persistence.TimerPersistence
SERVICE_NAME
-
-
Constructor Summary
Constructors Constructor Description FileTimerPersistence(Consumer<FileTimerPersistence> consumer, Supplier<jakarta.transaction.TransactionSynchronizationRegistry> txnRegistrySupplier, Supplier<org.jboss.modules.ModuleLoader> moduleLoaderSupplier, Supplier<org.jboss.as.controller.services.path.PathManager> pathManagerSupplier, boolean createIfNotExists, String path, String pathRelativeTo)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTimer(TimerImpl TimerImpl)Called when a timer is being persisted.static org.jboss.staxmapper.XMLExtendedStreamWritercreate(XMLStreamWriter writer)List<TimerImpl>loadActiveTimers(String timedObjectId, TimerServiceImpl timerService)Load all active timers for the given object.voidpersistTimer(TimerImpl TimerImpl)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.voidstart(org.jboss.msc.service.StartContext context)voidstop(org.jboss.msc.service.StopContext context)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-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jboss.as.ejb3.timerservice.persistence.TimerPersistence
timerDeployed
-
-
-
-
Constructor Detail
-
FileTimerPersistence
public FileTimerPersistence(Consumer<FileTimerPersistence> consumer, Supplier<jakarta.transaction.TransactionSynchronizationRegistry> txnRegistrySupplier, Supplier<org.jboss.modules.ModuleLoader> moduleLoaderSupplier, Supplier<org.jboss.as.controller.services.path.PathManager> pathManagerSupplier, boolean createIfNotExists, String path, String pathRelativeTo)
-
-
Method Detail
-
start
public void start(org.jboss.msc.service.StartContext context)
- Specified by:
startin interfaceorg.jboss.msc.Service
-
stop
public void stop(org.jboss.msc.service.StopContext context)
- Specified by:
stopin interfaceorg.jboss.msc.Service
-
addTimer
public void addTimer(TimerImpl TimerImpl)
Description copied from interface:TimerPersistenceCalled 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.- Specified by:
addTimerin interfaceTimerPersistence- Parameters:
TimerImpl- The timer
-
persistTimer
public void persistTimer(TimerImpl TimerImpl)
Description copied from interface:TimerPersistenceCalled when a timer is being persisted- Specified by:
persistTimerin interfaceTimerPersistence- Parameters:
TimerImpl- The timer
-
shouldRun
public boolean shouldRun(TimerImpl timer)
Description copied from interface:TimerPersistenceInvoked before running a timer in order to determine if this node should run the timer.- Specified by:
shouldRunin interfaceTimerPersistence- Parameters:
timer- The timer- Returns:
- true if the timer should be run
-
timerUndeployed
public void timerUndeployed(String timedObjectId)
Description copied from interface:TimerPersistenceSignals that a timer is being undeployed, and all cached data relating to this object should be dropped to prevent a class loader leak- Specified by:
timerUndeployedin interfaceTimerPersistence
-
loadActiveTimers
public List<TimerImpl> loadActiveTimers(String timedObjectId, TimerServiceImpl timerService)
Description copied from interface:TimerPersistenceLoad all active timers for the given object. If the object is an entity bean timers for all beans will be returned.- Specified by:
loadActiveTimersin interfaceTimerPersistence- Parameters:
timedObjectId- The timed object id to load timers for- Returns:
- A list of all active timers
-
registerChangeListener
public Closeable registerChangeListener(String timedObjectId, TimerPersistence.TimerChangeListener listener)
Description copied from interface:TimerPersistenceRegisters a listener to listed for new timers that are added to the database.- Specified by:
registerChangeListenerin interfaceTimerPersistence- Parameters:
timedObjectId- The timed objectlistener- The listener- Returns:
- A Closable that can be used to unregister the listener
-
create
public static org.jboss.staxmapper.XMLExtendedStreamWriter create(XMLStreamWriter writer) throws Exception
- Throws:
Exception
-
-