On Jun 3, 2008, at 10:37 AM, Paul Sandoz wrote:
>
> 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.
>
Might be a good idea to support the JSR 250 @PostConstruct and
@PreDestroy rather than creating a new interface.
Marc.
---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.