users@glassfish.java.net

Re: Embedded GlassFish clean shutdown and restart

From: Amy Roh <amy.roh_at_oracle.com>
Date: Wed, 26 Sep 2012 17:31:01 -0700

Use Glassfish.dispose if you don't need this GF instance anymore and you
want all resources to be released.

On 9/26/12 11:39 AM, Harald Wellmann wrote:
> 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