Interface TimerPersistence

All Known Implementing Classes:
DatabaseTimerPersistence, FileTimerPersistence

public interface TimerPersistence
Author:
Stuart Douglas
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Listener that gets invoked when a new timer is added to the underlying store.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.jboss.msc.service.ServiceName
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called when a timer is being persisted.
    loadActiveTimers(String timedObjectId, TimerServiceImpl timerService)
    Load all active timers for the given object.
    void
    Called when a timer is being persisted
    Registers a listener to listed for new timers that are added to the database.
    boolean
    Invoked before running a timer in order to determine if this node should run the timer.
    default 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
  • Field Details

    • SERVICE_NAME

      static final org.jboss.msc.service.ServiceName SERVICE_NAME
  • Method Details

    • addTimer

      void addTimer(TimerImpl timer)
      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.
      Parameters:
      timer - The timer
    • persistTimer

      void persistTimer(TimerImpl timer)
      Called when a timer is being persisted
      Parameters:
      timer - The timer
    • shouldRun

      boolean shouldRun(TimerImpl timer)
      Invoked before running a timer in order to determine if this node should run the timer.
      Parameters:
      timer - The timer
      Returns:
      true if the timer should be run
    • timerDeployed

      default void timerDeployed(String timedObjectId)
      Signals that the timer is being deployed and any internal structured required should be added.
      Parameters:
      timedObjectId -
    • timerUndeployed

      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
      Parameters:
      timedObjectId -
    • loadActiveTimers

      List<TimerImpl> loadActiveTimers(String timedObjectId, TimerServiceImpl timerService)
      Load all active timers for the given object. If the object is an entity bean timers for all beans will be returned.
      Parameters:
      timedObjectId - The timed object id to load timers for
      Returns:
      A list of all active timers
    • registerChangeListener

      Closeable registerChangeListener(String timedObjectId, TimerPersistence.TimerChangeListener listener)
      Registers a listener to listed for new timers that are added to the database.
      Parameters:
      timedObjectId - The timed object
      listener - The listener
      Returns:
      A Closable that can be used to unregister the listener