You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Andy Miller <an...@cotagesoft.com> on 2002/08/02 22:31:02 UTC

Handler Lifecycle/load-on-startup

Hi,

Does anyone out there have any suggestions for managing Axis Handler Lifecycle? 
I found several postings related to this, but I�m still unclear. Basically, 
I want to fire off a thread in my Handler and do some other initialization 
at startup time and some cleanup at shutdown time. I�d like the service 
implementation classes, and hence my handler, to be loaded at Tomcat startup 
time, rather than upon the first request to a service.  Another issue I 
have is that neither the �cleanup� nor the �finalize� methods in my handler 
class seem to be getting called when I shutdown Tomcat (using tomcat shutdown.bat).

I�ve tried setting �load-on-startup� in the Servlet configuration for Axis 
(in the Tomcat configuration file), but that didn�t help. I may try using 
the �Servlet Lifecycle Events� in the Java Servlet (i.e. configure my own 
ContextListener into the Servlet) to call a static method that initializes 
my thread. There are a couple of problems with this. First, I�d prefer to 
have the option to work with Servlet v.2.2. Second, I�d like to gather some 
information about the Axis Servlet at initialization time, which would not 
be available using the above technique. 

Another possible technique was 
alluded to in another thread: I would add a dummy Servlet (configured to 
load-on-startup) that sends a SOAP message to a dummy Axis web service, 
which would then cause my Handler to be initialized. This is better than 
nothing, but kind of awkward.

Any help with this would be greatly appreciated!

Thanks,
Andy Miller




_____________________________________________________________
Sign up for FREE email from Everyone.net email at http://www.everyone.net

Re: Handler Lifecycle/load-on-startup

Posted by Steve Loughran <st...@iseran.com>.
Having doing an (not 100% committed) rework of the AxisServlet, I think you
are right to be worried about lifecycle events...I think it needs testing
and its always a dog to test shutdown events. Still, testing servlet
closedown is nowhere as hard as debugging power down actions in an NT device
driver, so I am sure we can work something out.

I dont think Java guarantees that finalizers get called at destruct time. So
that leaves Servlet 2.3 lifecycles...as axis still targets servlet2.2 it
doesnt use these. I wonder if somehow, someone (hint hint) could fix axis to
call the shutdown process via a lifecycle on a servlet2.2 system, rather
than relying on the servlet shutdown process instead.

-steve




----- Original Message -----
From: "Andy Miller" <an...@cotagesoft.com>
To: <ax...@xml.apache.org>
Sent: Friday, August 02, 2002 13:31
Subject: Handler Lifecycle/load-on-startup


Hi,

Does anyone out there have any suggestions for managing Axis Handler
Lifecycle?
I found several postings related to this, but I'm still unclear. Basically,
I want to fire off a thread in my Handler and do some other initialization
at startup time and some cleanup at shutdown time. I'd like the service
implementation classes, and hence my handler, to be loaded at Tomcat startup
time, rather than upon the first request to a service.  Another issue I
have is that neither the "cleanup" nor the "finalize" methods in my handler
class seem to be getting called when I shutdown Tomcat (using tomcat
shutdown.bat).

I've tried setting "load-on-startup" in the Servlet configuration for Axis
(in the Tomcat configuration file), but that didn't help. I may try using
the "Servlet Lifecycle Events" in the Java Servlet (i.e. configure my own
ContextListener into the Servlet) to call a static method that initializes
my thread. There are a couple of problems with this. First, I'd prefer to
have the option to work with Servlet v.2.2. Second, I'd like to gather some
information about the Axis Servlet at initialization time, which would not
be available using the above technique.

Another possible technique was
alluded to in another thread: I would add a dummy Servlet (configured to
load-on-startup) that sends a SOAP message to a dummy Axis web service,
which would then cause my Handler to be initialized. This is better than
nothing, but kind of awkward.

Any help with this would be greatly appreciated!

Thanks,
Andy Miller




_____________________________________________________________
Sign up for FREE email from Everyone.net email at http://www.everyone.net