Class FileTimerPersistence
java.lang.Object
org.jboss.as.ejb3.timerservice.persistence.filestore.FileTimerPersistence
- All Implemented Interfaces:
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.msc.Service
NULLFields inherited from interface org.jboss.as.ejb3.timerservice.persistence.TimerPersistence
SERVICE_NAME -
Constructor Summary
ConstructorsConstructorDescriptionFileTimerPersistence(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
Modifier and TypeMethodDescriptionvoidCalled when a timer is being persisted.static org.jboss.staxmapper.XMLExtendedStreamWritercreate(XMLStreamWriter writer) loadActiveTimers(String timedObjectId, TimerServiceImpl timerService) Load all active timers for the given object.voidpersistTimer(TimerImpl TimerImpl) 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.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 leakMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jboss.as.ejb3.timerservice.persistence.TimerPersistence
timerDeployed
-
Constructor Details
-
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 Details
-
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
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
Description copied from interface:TimerPersistenceCalled when a timer is being persisted- Specified by:
persistTimerin interfaceTimerPersistence- Parameters:
TimerImpl- The timer
-
shouldRun
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
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
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
-