You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Irving Reid <ir...@baltimore.com> on 2001/01/31 20:29:46 UTC
Orderly shutdown of SOAP services
I'm working with Jakarta-Tomcat 3.2.1 and Apache SOAP 2.0 (but I have
also looked in the 2.1-RC1 source tree, in case there were relevant
changes).
I'm creating a SOAP service based on an application-scope object that
needs to do some work at shutdown time. Under the current Tomcat
servlet framework, servlets have a 'destroy()' method that gets called
by the framework when that servlet is unloaded, or the framework shuts
down.
The current SOAP implementation does not override the default
implementation inherited from javax.servlet.GenericServlet.
It would be simple to override destroy() in org.apache.soap.server.http.
RPCRouterServlet, but then we would need to supply an interface for the
servlet to call into the SOAP object.
Is there any existing work being done on this? If not, here's what I
would propose:
Define an interface, named something like org.apache.soap.server.SOAPSer
vice, which provides some set of lifecycle methods. At the least,
init() and destroy(), but for EJB server environments it might be nice
to support prepare-to-be-serialized() and you-were-just-deserialized()
(though probably not with those names...)
RPCRouterServlet needs to do some concurrency control, because the
servlet framework could call destroy() while some other threads are
still processing SOAP calls. Once all other threads are clear of the
servlet, destroy() should iterate through all remaining SOAP service
objects, check whether they implement SOAPService, and destroy() them.
At the same time, we can drop our pointer to the SOAP service objects
just in case GC would trigger some useful shutdown code. This isn't
reliable, since the servlet framework could do a System.exit() before
GC has a chance to finalize those objects. We could do a System.gc() in
RPCRouterServlet to force the issue, but even that isn't guaranteed to
finalize everything.
- irving -