axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony Dean" <>
Subject RE: [axis2]a little frustrated
Date Fri, 08 Dec 2006 13:37:56 GMT
Thanks Sanjiva... I'm calmer now :-).

I didn't realize that the ServiceImpl was called once per session.  I was thinking that there
was only one ServiceImpl and that the init() was called for each session.  So you load a new
instance of ServiceImpl for every session and then call its init() method.

If your service is application scoped it seems safe to just not implement ServiceLifeCycle
and just let init() handle the one-time initialization during session instantiation since
it will only be called once.  In this case it appears that init() is called when my service
is deployed (not deferred until the first request).  So an initial session is created at startup/deployment?
 That works in may case, because I don't want to perform one-time initialization during the
first request, thereby, slowing down that first call to my service.  But, can I count on this
behavior in the long run... ie., will this behavior ever change?

Still need to explain to me why ServiceLifeCycle startUp() method is not passed a fully populated
AxisService?  That is, axisService.getFileName() is null.  I'll wait for a response from Deepal.


-----Original Message-----
From: Sanjiva Weerawarana [] 
Sent: Friday, December 08, 2006 4:47 AM
Subject: RE: [axis2]a little frustrated

Sorry its frustrating you Tony but the lifecycle change had to be done to make it consistent.
The problem of course is that service init/destroy and service implementation class lifecyles
may be different depending on the scope of the service. If the scope is session then the service
impl class will get new'ed up multiple times, one per session.
So the lifecycle stuff can't be in that class- it needs to be elsewhere an we decided to create
a separate class. This was discussed on this list.

Not sure what's wrong with the other issue- Deepal??


On Thu, 2006-12-07 at 09:42 -0500, Tony Dean wrote:
> Some more information...
> When my startUp method is called AxisService.getFileName() returns  
> null.
> When my init method is called
>  ServiceContext.getAxisService().getFileName() contains the correct  
> information.
> Just looks like AxisService is not fully populated with information  
> until the session context is created.  Can you explain?
> In my case (scope=application), it appears that I can just put all my  
> one-time initialization in init() since I will only be creating one  
> session.  It also appears that init() is called during Axis2  
> deployment.  I want to get all the initialization done before the  
> first request comes in.  Is this correct?
> However, this would not work if I needed session management.  In that  
> case I would need to put one-time initialization back in startUp.
> Thanks.
> -----Original Message-----
> From: Tony Dean []
> Sent: Wednesday, December 06, 2006 5:52 PM
> To:
> Subject: [axis2]a little fustrated
> Hi,
> I have put down Axis2 1.1 and have found that some things have changed that I relied
> AxisService.getFileName use to return a URL to the service.  I was able to acquire resources
from my aar or exploded directory bundled with my service.  This method call now returns null.
> When you make changes moving forward, you have to ensure backward capability.  Or at
least document a valid reason for such change.
> How do I proceed now in order to get the same functionality?
> ServiceLifeCycle:
> It seems the life cycle changes you have put into 1.1 that you have to specify an additional
class that contains the startUp/shutDown methods.  I just want one service class that performs
startUp, shutDown, init, destroy, and business logic.  The startUp method creates information
that must be shared with the init, and business logic methods.  I'm not sure if I have the
lifecycle class == service class if I get one or two instances of my class.  If I get one
instance then I can share information with worrying about additional calloboration.  If I
get two instances I will have to do what you do in your lifecycle example.  That is create
parameters and stuff them in axis service so that the real service code can access it.  For
application scope I hope that I only get one instance of my class even if the lifecycle and
service class are the same.  Is this the case?
> Thanks.
> Tony Dean
> SAS Institute Inc.
> 919.531.6704
> SAS... The Power to Know
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
Sanjiva Weerawarana, Ph.D.
Founder & Director; Lanka Software Foundation; Founder, Chairman
& CEO; WSO2, Inc.; Director; Open Source Initiative;
Member; Apache Software Foundation; Visiting Lecturer; University of

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message