users@jersey.java.net

Re: [Jersey] HttpServer.stop() propagated to resource class

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 03 Jun 2008 16:37:21 +0200

Hi Richard,

Richard Levenberg wrote:
> I have cursorily looked at the code but I was wondering if someone could
> point me in the right direction. My resource classes that get loaded up
> when I start the lightweight server do a bunch of stuff (initialization,
> threads, etc.) that I would like to cleanup. Is there any way to
> propagate the stop() of the HttpServer into the resource classes that
> were found? Any hints greatly appreciated.
>

Currently there is no "un-initiation" or "un-deploy" mechanism in Jersey.

I just had a look at the LW HTTP server APIs and i don't think, even if
it were currently possible in Jersey to undeploy singleton root resource
classes, that it is possible to configure the LW HTTP server to notify
Jersey :-(

However, it should be possible in servlet. The Servlet.destroy method
could defer to WebApplication.destroy(), which in turn could find the
singleton instances of root resource classes that implement say the
"Destroyable" interface and call destroy on those instances.

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109