Class MessageGroupStoreReaper

All Implemented Interfaces:
Runnable, DisposableBean, InitializingBean, Lifecycle, Phased, SmartLifecycle

public class MessageGroupStoreReaper extends Object implements Runnable, DisposableBean, InitializingBean, SmartLifecycle
Convenient configurable component to allow explicit timed expiry of MessageGroup instances in a MessageGroupStore. This component provides a no-args run() method that is useful for remote or timed execution and a destroy() method that can optionally be called on shutdown.
Dave Syer, Dave Turanski, Artem Bilan
  • Constructor Details

    • MessageGroupStoreReaper

      public MessageGroupStoreReaper(MessageGroupStore messageGroupStore)
    • MessageGroupStoreReaper

      public MessageGroupStoreReaper()
  • Method Details

    • setExpireOnDestroy

      public void setExpireOnDestroy(boolean expireOnDestroy)
      Flag to indicate that the stores should be expired when this component is destroyed (i.e. usually when its enclosing ApplicationContext is closed).
      expireOnDestroy - the flag value to set
    • setTimeout

      public void setTimeout(long timeout)
      Timeout in milliseconds (default -1). If negative then no groups ever time out. If greater than zero then all groups older than that value are expired when this component is run().
      timeout - the timeout to set
    • setMessageGroupStore

      public void setMessageGroupStore(MessageGroupStore messageGroupStore)
      A message group store to expire according the other configurations.
      messageGroupStore - the MessageGroupStore to set
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface InitializingBean
    • destroy

      public void destroy()
      Specified by:
      destroy in interface DisposableBean
    • run

      public void run()
      Expire all message groups older than the timeout provided. Normally this method would be executed by a scheduled task.
      Specified by:
      run in interface Runnable
    • start

      public final void start()
      Specified by:
      start in interface Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface Lifecycle
    • isRunning

      public final boolean isRunning()
      Specified by:
      isRunning in interface Lifecycle
    • getPhase

      public int getPhase()
      Specified by:
      getPhase in interface Phased
      Specified by:
      getPhase in interface SmartLifecycle
    • setPhase

      public void setPhase(int phase)
    • isAutoStartup

      public boolean isAutoStartup()
      Specified by:
      isAutoStartup in interface SmartLifecycle
    • setAutoStartup

      public void setAutoStartup(boolean autoStartup)