Here's what you need:
services.xml
<service name=3D"yourService"
class=3D"yourService.serviceLifeCyle"
scope=3D"request">
<parameter
name=3D"ServiceClass">yourService.Impl</para
meter>=20
...
<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=3Drequest, a new
session =
will be created on every request.
Hope this explains what you need.
I use scope=3Dapplication 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:janusz.martyniak imperial.ac.uk]=20
Sent: Thursday, January 11, 2007 5:43 AM
To: axis-user ws.apache.org
Subject: Re: AW: ServiceLifecycle
Deepal Jayasinghe wrote:
> Hi Janusz;
>=20
>> but,
>>
>> The init() is called every time I invoke the
method.=20
>=20
> 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.
>=20
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.
>=20
>> 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.
>=20
> Totally agreed.
>=20
Appreciated , but is
there a way out ???
cheers, Janusz
------------------------------------------------------------
---------
To unsubscribe, e-mail: axis-user-unsubscribe ws.apache.org
For additional commands, e-mail: axis-user-help ws.apache.org
------------------------------------------------------------
---------
To unsubscribe, e-mail: axis-user-unsubscribe ws.apache.org
For additional commands, e-mail: axis-user-help ws.apache.org
|