mRaza
mRaza

Reputation: 65

How to create multithreading in a stateless session bean?

I have created Webservice using JAXWS and hosted it as stateless session bean in jboss6. Following is the web service code:

@Stateless
@WebService(serviceName = "CommonSmsServices", name = "CommonSmsServices", wsdlLocation = "META-INF/wsdl/CommonSmsServices.wsdl", endpointInterface = "com.sms.webservice.common.CommonServices")
public class CommonServicesImpl implements CommonServicesLocal,CommonServicesRemote {
      //.....
      // methods
      //.....

}

This works fine with a single Http session. Now I am facing the problem while running multiple sessions, that the response time becomes very slow. I did YourKit porfiling for memory and threading sampling. Memory utilization look good. but in thread section it shows one htpp thread is waiting for other to complete.

I have also gone through the Java EE session bean documentation. It says session bean are single threaded. Is there a performance issue with session beans that handle multiple Http session concurrently?

Is there a way or configuration in JBoss AS 6 to improve my web service performance?

Upvotes: 0

Views: 468

Answers (1)

Random42
Random42

Reputation: 9159

In an EJB (including Stateless ones) multithreading is supported by the container. If you want your data to be stored between to distinct calls you probably should use a Statefull bean instead; this also supports multithreading.

Upvotes: 1

Related Questions