Hi all,
I developed a webservice with axis/tomcat, which got some information
from a database.
All worked fine, but the problem is that the information was not
modified frequently, and was obtained each time that my webservice was
invoked.
So, I decided to migrate my webservice to axis2, ant put inside my
service class the following methods:
public void init(ServiceContext serviceContext) {
// my initialization code here
}
public void destroy(ServiceContext serviceContext) {
// this code will be executed when the service is unloaded
}
In the method init I do a query to a database to get the information,
and put it in a Map of the ServiceContext.
At this point all works like I want, the method init is invoked only one
time.
The problem is that I modified the scope from "application" to
"request", to force the creation of a new instance of the service class
per request. I did this modification because I want to process various
requests in simultaneous. With this modification, each time a request is
done the init method is invoked, and I want that it will be only invoked
one time.
How can I solve this problem?
Regards,
Rui Torres