users@glassfish.java.net

Re: _at_PreDestroy method in web service not called when web app undeployed?

From: <glassfish_at_javadesktop.org>
Date: Mon, 14 Jul 2008 08:40:30 PDT

OK, thanks for the explanation, that helps a lot.

I understand your explanation about @PreDestroy - it's related to garbage collection - clearly not what I want.

I am deploying my application in a WAR file (by either copying it to the autodeploy directory, or using the Netbeans IDS "undeploy and deploy" action) so I should be able to implement a ServletContextListener as you suggest.

Regarding starting a thread in a container not being kosher, well, I've written several web apps that need some kind of background processing, so I can't see any way to avoid this. If there's a standard way that this is supposed to be done, that would be fine, but it's not so easy to figure out what that would be. I'm coming at this whole web service programming thing from the background of someone who's used to writing C code to listen on sockets and fork off handlers. The scale of all this Java EE machinery is quite intimidating for us mere mortal programmers who learned our trade back in the day when the entire app progam, operating system and all, would fit in a few Kbytes of memory.

Thanks,

Duncan
[Message sent by forum member 'duncant' (duncant)]

http://forums.java.net/jive/thread.jspa?messageID=286449