Package io.joynr.runtime
Class ShutdownNotifier
- java.lang.Object
-
- io.joynr.runtime.ShutdownNotifier
-
public class ShutdownNotifier extends Object
-
-
Constructor Summary
Constructors Constructor Description ShutdownNotifier()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidprepareForShutdown()Will callPrepareForShutdownListener.prepareForShutdown()for eachregistered listenerasynchronously, and waiting a total of five seconds for all to complete or will then timeout without waiting.voidregisterForShutdown(ShutdownListener shutdownListener)Register to have the listener's shutdown method called at system shutdown NOTE: no shutdown order is guaranteed registered using this method.voidregisterHivemqMqttPrepareForShutdownListener(PrepareForShutdownListener listener)Register to have HivemqMqttClientFactory.prepareForShutdown() called at system prepareForShutdown.voidregisterHivemqMqttShutdownListener(ShutdownListener listener)Register to have HivemqMqttClientFactory.shutdown() called at system shutdown.voidregisterMessageTrackerPrepareForShutdownListener(PrepareForShutdownListener listener)Register to have MessageTrackerForGracefulShutdown.prepareForShutdown() called at system prepareForShutdown.voidregisterMessageTrackerShutdownListener(ShutdownListener listener)Register to have MessageTrackerForGracefulShutdown.shutdown() called at system shutdown.voidregisterPrepareForShutdownListener(PrepareForShutdownListener prepareForShutdownListener)Register to have the listener's prepareForShutdown method called at system prepareForShutdown NOTE: no shutdown order is guaranteed registered using this method.voidregisterProxyInvocationHandlerPrepareForShutdownListener(PrepareForShutdownListener listener)Register to have ProxyInvocationHandler.prepareForShutdown() called at system shutdown.voidregisterProxyInvocationHandlerShutdownListener(ShutdownListener listener)Register to have ProxyInvocationHandler.shutdown() called at system shutdown.voidregisterToBeShutdownAsLast(ShutdownListener shutdownListener)Register to have the listener's shutdown method called at system shutdown as one of the last listeners.voidshutdown()CallsShutdownListener.shutdown()for eachregistered listenersynchronously in turn.voidunregister(PrepareForShutdownListener listener)
-
-
-
Method Detail
-
registerHivemqMqttPrepareForShutdownListener
public void registerHivemqMqttPrepareForShutdownListener(PrepareForShutdownListener listener) throws IllegalArgumentException
Register to have HivemqMqttClientFactory.prepareForShutdown() called at system prepareForShutdown.- Parameters:
listener- PrepareForShutdownListener- Throws:
IllegalArgumentException- when parent class of listener is of unsupported class
-
registerMessageTrackerPrepareForShutdownListener
public void registerMessageTrackerPrepareForShutdownListener(PrepareForShutdownListener listener) throws IllegalArgumentException
Register to have MessageTrackerForGracefulShutdown.prepareForShutdown() called at system prepareForShutdown.- Parameters:
listener- PrepareForShutdownListener- Throws:
IllegalArgumentException- when parent class of listener is of unsupported class
-
registerProxyInvocationHandlerPrepareForShutdownListener
public void registerProxyInvocationHandlerPrepareForShutdownListener(PrepareForShutdownListener listener) throws IllegalArgumentException
Register to have ProxyInvocationHandler.prepareForShutdown() called at system shutdown.- Parameters:
listener- PrepareForShutdownListener- Throws:
IllegalArgumentException- when parent class of listener is of unsupported class
-
registerHivemqMqttShutdownListener
public void registerHivemqMqttShutdownListener(ShutdownListener listener) throws IllegalArgumentException
Register to have HivemqMqttClientFactory.shutdown() called at system shutdown.- Parameters:
listener- ShutdownListener- Throws:
IllegalArgumentException- when parent class of listener is of unsupported class
-
registerMessageTrackerShutdownListener
public void registerMessageTrackerShutdownListener(ShutdownListener listener) throws IllegalArgumentException
Register to have MessageTrackerForGracefulShutdown.shutdown() called at system shutdown.- Parameters:
listener- ShutdownListener- Throws:
IllegalArgumentException- when parent class of listener is of unsupported class
-
registerProxyInvocationHandlerShutdownListener
public void registerProxyInvocationHandlerShutdownListener(ShutdownListener listener) throws IllegalArgumentException
Register to have ProxyInvocationHandler.shutdown() called at system shutdown.- Parameters:
listener- ShutdownListener- Throws:
IllegalArgumentException- when parent class of listener is of unsupported class
-
registerForShutdown
public void registerForShutdown(ShutdownListener shutdownListener) throws IllegalArgumentException
Register to have the listener's shutdown method called at system shutdown NOTE: no shutdown order is guaranteed registered using this method. Listeners which should be invoked in specific order are to be registered using dedicated register methods.- Parameters:
shutdownListener- ShutdownListener- Throws:
IllegalArgumentException- when parent class of listener is of unsupported class
-
registerToBeShutdownAsLast
public void registerToBeShutdownAsLast(ShutdownListener shutdownListener) throws IllegalArgumentException
Register to have the listener's shutdown method called at system shutdown as one of the last listeners. It is a partial ordering and ensures that this listener's shutdown will be called after all listeners registered usingregisterForShutdown(ShutdownListener). NOTE: Listeners who manage some executor service should use this method.- Parameters:
shutdownListener- ShutdownListener- Throws:
IllegalArgumentException- when parent class of listener is of unsupported class
-
registerPrepareForShutdownListener
public void registerPrepareForShutdownListener(PrepareForShutdownListener prepareForShutdownListener) throws IllegalArgumentException
Register to have the listener's prepareForShutdown method called at system prepareForShutdown NOTE: no shutdown order is guaranteed registered using this method. Listeners which should be invoked in specific order are to be registered using dedicated register methods.- Parameters:
prepareForShutdownListener- ShutdownListener- Throws:
IllegalArgumentException- when parent class of listener is of unsupported class
-
prepareForShutdown
public void prepareForShutdown() throws InterruptedExceptionWill callPrepareForShutdownListener.prepareForShutdown()for eachregistered listenerasynchronously, and waiting a total of five seconds for all to complete or will then timeout without waiting.- Throws:
InterruptedException
-
shutdown
public void shutdown()
CallsShutdownListener.shutdown()for eachregistered listenersynchronously in turn.
-
unregister
public void unregister(PrepareForShutdownListener listener)
-
-