I'm upgrading to the latest version of HornetQ 2.3 and am interested in knowing how to properly shutdown a 2.3 stand alone server.
Our server currently running under 2.1.1 is a very simple app -- Here is the code
* Just a wrapper around the HornetQBootstrapServer class in case
* we want to put in anyspecific code.
public class HCMHornetQBootstrapServer extends HornetQBootstrapServer
public HCMHornetQBootstrapServer(KernelConfig kernelConfig, String... args) throws Exception
public HCMHornetQBootstrapServer(String... args) throws Exception
public void start()
public static void main(String args) throws Exception
However, the method addShutDownHook() is no longer visible in 2.3. So, how do I shutdown my standalone server in the proper manner? Does 2.3 shut down all the bits and pieces for me? I'm guessing not because, in the examples directory in the 2.3 installation, there is this set of code. Maybe I should be using Runtime.getRuntime().addShutdownHook() ? Is that safe to do?
// Step 8. Be sure to close our resources!
if (sf != null)
// Step 9. Shutdown the container
if (hornetQ != null)
Hmmm...that method was made private by mistake. We shouldn't have changed it.
I will make sure I change it to the next version (2.4).
You can change it in a fork of yours if you like!