Tbanks Deepal for your informative response. Now I feel confident on how to write my 'application' scoped web service (ie, taking care to be threadsafe).

Deepal jayasinghe wrote:
Jonathan Joseph wrote:
I have a couple of questions regarding Axis2 web services configured to run with service scope set to 'Application':

1) Is the web service a singleton?
yes
2) Is the web service thread-safe?
yes and no

I think that the answers are 1) Yes, 2) No. I couldn't find an explicit answer in the Axis2 documentation.
Once you deploy a service in application scope we create only one instance of the service implementation class. And we store the instance in the ServiceContext. So each and every request coming to that service uses the same service instance. However in web service world we have to write our services in a stateless manner , meaning write the class so that we do not store any class level variable in the service impl class. Then the service invocation would become thread safe as well.

Thank you!
Deepal

---------------------------------------------------------------------
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]

Reply via email to