【发布时间】:2011-10-13 04:12:21
【问题描述】:
好的,我正在使用 Apache Axis2 和 Spring Framework。基本上,WebServiceHandler 类是公开所有 Web 服务操作的类。所以当一个请求进来时,这是被调用的类。 我的理解是,对于每个请求,Tomcat 或 Axis2 都应该创建一个新线程。但是执行“Thread.currentThread().getId()”和“Thread.currentThread().getName()”总是具有相同的 id 和 name。
我认为这会导致我的 DAO 出现问题,因为我使用 Hibernate 创建 3 个 SessionFactories 并使用当前线程模型执行查询,这使得整个系统非常慢。
在调用我的 DAO 类之前,我可以为每个操作生成一个新线程,但还没有尝试过。有什么方法可以通过 Axis2 或 Spring 中的配置来解决这个问题?谢谢。
下面是我的 applicationContext.xml 的一部分:
<!-- Axis2 Web Service, but to Spring, its just another bean that has dependencies -->
<bean id="springContext" class="com.ws.beans.spring.SpringContext"/>
<bean id="springAwareService" class="com.ws.beans.WebServiceHandler" >
<constructor-arg ref="springContext" />
</bean>
【问题讨论】:
标签: web-services hibernate spring axis2 axis