Stopping a component
Does the method stop() in a component work before shutting down the server (tigase-server-8.0.0-SNAPSHOT-b5058)?
Added by Wojciech Kapcia 11 months ago
It's described in the documentation http://docs.tigase.org/tigase-server/snapshot/Development_Guide/html_chunk/cil8.html:
h3. Stopping a component
Component instance may be stopped at any point of Tigase XMPP Server runtime, ie. due to reconfiguration, or due to server graceful shutdown.
In both cases following methods of a component will be called:
void stop() - first method stops component internal processing queues.
void beforeUnregister() (optional) - if component implements
UnregisterAwareinterface this method is called to notify instance of a component that it is being unloaded.
void unregister(Kernel kernel) (optional) - if component implements RegistrarBean called to give component a way to unregister beans (if needed).
So to answer your question - the method will be called before stopping the component instance but not necessarily server.
You can use method
tigase.sys.TigaseRuntime#addShutdownHook() to add your custom hook, which will be executed during server shutdown.