Class SimpleShutdownListenable
java.lang.Object
org.jboss.threads.SimpleShutdownListenable
- All Implemented Interfaces:
ShutdownListenable
A simple shutdown-listenable registry.
- Author:
- David M. Lloyd
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<A> voidaddShutdownListener(EventListener<A> shutdownListener, A attachment) Add a shutdown listener.voidshutdown()Run and remove all registered listeners, and mark this object as having been shut down so that future listeners are invoked immediately.
-
Constructor Details
-
SimpleShutdownListenable
public SimpleShutdownListenable()
-
-
Method Details
-
addShutdownListener
Add a shutdown listener. If the target object is already shut down, the listener is invoked directly.- Specified by:
addShutdownListenerin interfaceShutdownListenable- Type Parameters:
A- the attachment type- Parameters:
shutdownListener- the listenerattachment- 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.
-