Class SimpleShutdownListenable

java.lang.Object
org.jboss.threads.SimpleShutdownListenable
All Implemented Interfaces:
ShutdownListenable

public final class SimpleShutdownListenable extends Object implements ShutdownListenable
A simple shutdown-listenable registry.
Author:
David M. Lloyd
  • Constructor Details

    • SimpleShutdownListenable

      public SimpleShutdownListenable()
  • Method Details

    • addShutdownListener

      public <A> void addShutdownListener(EventListener<A> shutdownListener, A attachment)
      Add a shutdown listener. If the target object is already shut down, the listener is invoked directly.
      Specified by:
      addShutdownListener in interface ShutdownListenable
      Type Parameters:
      A - the attachment type
      Parameters:
      shutdownListener - the listener
      attachment - the attachment value to pass to the listener
    • shutdown

      public void shutdown()
      Run and remove all registered listeners, and mark this object as having been shut down so that future listeners are invoked immediately.