You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Tony Dean <To...@sas.com> on 2006/12/06 23:51:42 UTC

[axis2]a little fustrated

Hi,

I have put down Axis2 1.1 and have found that some things have changed that I relied on.

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.  Why?

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
tony.dean@sas.com

SAS... The Power to Know
http://www.sas.com


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


RE: [axis2]a little frustrated

Posted by Tony Dean <To...@sas.com>.
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.

Thanks.

-----Original Message-----
From: Sanjiva Weerawarana [mailto:sanjiva@opensource.lk] 
Sent: Friday, December 08, 2006 4:47 AM
To: axis-dev@ws.apache.org
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??

Sanjiva.

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 [mailto:Tony.Dean@sas.com]
> Sent: Wednesday, December 06, 2006 5:52 PM
> To: axis-dev@ws.apache.org
> Subject: [axis2]a little fustrated
> 
> Hi,
> 
> I have put down Axis2 1.1 and have found that some things have changed that I relied on.
> 
> 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.  Why?
> 
> 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
> tony.dean@sas.com
> 
> SAS... The Power to Know
> http://www.sas.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
> 
--
Sanjiva Weerawarana, Ph.D.
Founder & Director; Lanka Software Foundation; http://www.opensource.lk/ Founder, Chairman & CEO; WSO2, Inc.; http://www.wso2.com/ Director; Open Source Initiative; http://www.opensource.org/ Member; Apache Software Foundation; http://www.apache.org/ Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


RE: [axis2]a little frustrated

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
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??

Sanjiva.

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 [mailto:Tony.Dean@sas.com] 
> Sent: Wednesday, December 06, 2006 5:52 PM
> To: axis-dev@ws.apache.org
> Subject: [axis2]a little fustrated
> 
> Hi,
> 
> I have put down Axis2 1.1 and have found that some things have changed that I relied on.
> 
> 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.  Why?
> 
> 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
> tony.dean@sas.com
> 
> SAS... The Power to Know
> http://www.sas.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
> 
-- 
Sanjiva Weerawarana, Ph.D.
Founder & Director; Lanka Software Foundation; http://www.opensource.lk/
Founder, Chairman & CEO; WSO2, Inc.; http://www.wso2.com/
Director; Open Source Initiative; http://www.opensource.org/
Member; Apache Software Foundation; http://www.apache.org/
Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


RE: [axis2]a little frustrated

Posted by Tony Dean <To...@sas.com>.
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 [mailto:Tony.Dean@sas.com] 
Sent: Wednesday, December 06, 2006 5:52 PM
To: axis-dev@ws.apache.org
Subject: [axis2]a little fustrated

Hi,

I have put down Axis2 1.1 and have found that some things have changed that I relied on.

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.  Why?

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
tony.dean@sas.com

SAS... The Power to Know
http://www.sas.com


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org