users@glassfish.java.net

Embedded GlassFish clean shutdown and restart

From: Harald Wellmann <hwellmann.de_at_gmail.com>
Date: Wed, 26 Sep 2012 20:39:21 +0200

Is it possible to cleanly shutdown and restart Embedded GlassFish within
the same VM?

This is what I'm doing:

GlassFish glassFish = GlassFishRuntime.bootstrap().newGlassFish(gfProps);
glassFish.start();
glassFish.stop();

Now after calling glassFish.stop(), I still see a number of threads
running, e.g. with name "deployment-jar-scanner", "transaction-manager"
and some others.

What's the proper way to stop these threads and free all resources
allocated by GlassFish?

(Tested with GlassFish 3.1.2.)

Best regards,
Harald