1. yes, but,  probably some way to trigger service load before the first actual request.
 
2. yes, you have to make sure your service is multi-threaded... just like any j2ee component.


From: Dave Cowing [mailto:[EMAIL PROTECTED]
Sent: Sunday, July 23, 2006 9:53 AM
To: [email protected]
Subject: RE: [Axis2] How to perform startup initialization?

Looks like this would work, but I see a couple of issues:
 
1) Initialization would occur the first time the service is called (based on some experimentation) - so the first ws client calling the service would get the startup latency hit
2) If I scope the service as "application" level, then won't I be using a single instance of my service class for all service calls?  If this is the case, I'd be worried about concurrency issues (or I would have to avoid using any class variables in my service class).
 
Thoughts?
 
Thanks,
Dave


From: Tony Dean [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 22, 2006 5:26 PM
To: [email protected]
Subject: RE: [Axis2] How to perform startup initialization?

You can code your service to implement service lifecycle semantics:
init(ServiceContext sc)
destroy(ServiceContext sc)
 
If your service is configured with scope="application" (service.xml), then your init() will be called once when your service is loaded and once when your application is destroyed.  You can then perform your DB connections and any other one time initialization more conveniently.


From: Dave Cowing [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 22, 2006 3:04 PM
To: [email protected]
Subject: [Axis2] How to perform startup initialization?

I'm getting started with Axis 2 and am looking to perform some initialization when axis2 starts up.  Specifically, I'm looking to configure a database pool and a couple of other resource pools that will be shared by web services.
 
In a servlet, I do this by creating a servlet listener, configuring the pool objects and dropping them into the servlet context.
 
I assume that I should be looking at the Service Group or Configuration Context to store the pools.  I also tried creating an AxisObserver, but I don't seem to be able to access the contexts.
 
How can I create a method that's called when axis2 starts up and has access to these contexts?
 
Thanks,
Dave

Reply via email to