users@glassfish.java.net

Web Service Constructor Calls

From: <glassfish_at_javadesktop.org>
Date: Tue, 15 Jun 2010 22:59:28 PDT

Hi,

I'm new to GlassFish and I'm preparing to migrate an Axis2 web service to our newly installed GlassFish 3.0 server. So far I've only added a couple of operations, a Hello() method and a method that returns the client IP. I've noticed that the constructor seems to be called almost every time either of the operations is used via the tester page. This is different than the behavior we had in Apache/Axis2 where the constructor was only called the first time the service was used after a reload or restart and repeated calls to the various operations didn't result in a new instantiation.

At first I thought this was because each HTTP thread was causing a new instantiation but I started logging the thread ID's and even if the same thread is used the constructor is still called. Sometimes it's not, but more often it is. I haven't been able to determine how GlassFish is deciding a new object needs to be created.

Is this behavior normal? I tried to find some information on how this process works but I wasn't able to find anything specifically related to this. My basic issue is that the web service in Axis2 loads a properties file in the constructor. This may not be the most efficient way to do something like this in GlassFish but I can't see how to avoid the overhead if the constructor is going to be called so frequently.

Thanks!
Paul
[Message sent by forum member 'paulwade']

http://forums.java.net/jive/thread.jspa?messageID=474428