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
  • 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:
      start in interface org.jboss.msc.Service
    • stop

      public void stop(org.jboss.msc.service.StopContext context)
      Specified by:
      stop in interface org.jboss.msc.Service
    • addTimer

      public void addTimer(TimerImpl TimerImpl)
      Description copied from interface: TimerPersistence
      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 to CANCELED.
      Specified by:
      addTimer in interface TimerPersistence
      Parameters:
      TimerImpl - The timer
    • persistTimer

      public void persistTimer(TimerImpl TimerImpl)
      Description copied from interface: TimerPersistence
      Called when a timer is being persisted
      Specified by:
      persistTimer in interface TimerPersistence
      Parameters:
      TimerImpl - The timer
    • shouldRun

      public boolean shouldRun(TimerImpl timer)
      Description copied from interface: TimerPersistence
      Invoked before running a timer in order to determine if this node should run the timer.
      Specified by:
      shouldRun in interface TimerPersistence
      Parameters:
      timer - The timer
      Returns:
      true if the timer should be run
    • timerUndeployed

      public void timerUndeployed(String timedObjectId)
      Description copied from interface: TimerPersistence
      Signals 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:
      timerUndeployed in interface TimerPersistence
    • loadActiveTimers

      public List<TimerImpl> loadActiveTimers(String timedObjectId, TimerServiceImpl timerService)
      Description copied from interface: TimerPersistence
      Load all active timers for the given object. If the object is an entity bean timers for all beans will be returned.
      Specified by:
      loadActiveTimers in interface TimerPersistence
      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: TimerPersistence
      Registers a listener to listed for new timers that are added to the database.
      Specified by:
      registerChangeListener in interface TimerPersistence
      Parameters:
      timedObjectId - The timed object
      listener - 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