Here's what you need:
services.xml
<service name="yourService"
class="yourService.serviceLifeCyle" scope="request">
<parameter name="ServiceClass">yourService.Impl</parameter>
...
<service/>
yourService.serviceLifeCycle class is your service lifecycle class and it will
be loaded one and only one time. This class must implement
startUp(ConfigurationContext ctx, AxisService service) and
shutDown(ConfigurationContext ctx, AxisService service) and these methods are
called once at the obvious time.
yourService.Impl is your implementation class. It should contain an
init(ServiceContext ctx) and destroy(ServiceContext ctx). These methods are
session-based and will be called everytime a new session is created and
destroyed. And since you specify scope=request, a new session will be created
on every request.
Hope this explains what you need.
I use scope=application so I have not verified this myself, but I investigated
all possible lifecycle scenarios when I was deciding how I wanted to implement
my service.
-Tony
-----Original Message-----
From: Dr Janusz Martyniak [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 11, 2007 5:43 AM
To: [email protected]
Subject: Re: AW: ServiceLifecycle
Deepal Jayasinghe wrote:
> Hi Janusz;
>
>> but,
>>
>> The init() is called every time I invoke the method.
>
> That will only happen if you deploy your service in request scope , if
> you deploy your service in application scope then that will never happen.
>
Well, if I deploy my service as an application then init() is called once and
all the clients will share the implementation instance and the latter is not
what I want.
What I'm trying to achieve is to keep the request mode, so every client gets
his own instance of a service, but have a possibility to initialise the service
once, possibly at servlet loading time, or at a very first call. The init()
method does not deliver this.
>
>> Thre are lots of applications one would like to initialise the whole
>> system before actually performing any requests. Otherwise every call
>> to an operation has to perform often complex initialisation steps.
>
> Totally agreed.
>
Appreciated ;-), but is there a way out ???
cheers, Janusz
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]