Mule Java 组件和线程安全
Mule Java Component and Thread Safe
此 http://www.mulesoft.org/documentation/display/current/Configuring+Java+Components 的摘录是:
When you specify the class directly on the component or pooled-component element, the PrototypeObjectFactory is used by default, and a new instance is created for each invocation, or a new pooled component is created in the case of the PooledJavaComponent
并且,我已经将 Java class 配置为 Mule Java 组件,如下所示:
<component class="com.mycompany.SalesOrderProductsHandler" doc:name="Java" />
。 class SalesOrderProductsHandler
已实现 org.mule.api.lifecycle.Callable
并有一个名为 targetProductsIndex.
的状态变量
我的问题如下:
每次收到新请求时都会创建 com.mycompany.SalesOrderProductsHandler
的新实例吗?
文档绝对正确。有:
<component class="com.mycompany.SalesOrderProductsHandler" />
每次调用你都会得到一个新的 com.mycompany.SalesOrderProductsHandler
实例。
此 http://www.mulesoft.org/documentation/display/current/Configuring+Java+Components 的摘录是:
When you specify the class directly on the component or pooled-component element, the PrototypeObjectFactory is used by default, and a new instance is created for each invocation, or a new pooled component is created in the case of the PooledJavaComponent
并且,我已经将 Java class 配置为 Mule Java 组件,如下所示:
<component class="com.mycompany.SalesOrderProductsHandler" doc:name="Java" />
。 class SalesOrderProductsHandler
已实现 org.mule.api.lifecycle.Callable
并有一个名为 targetProductsIndex.
我的问题如下:
每次收到新请求时都会创建 com.mycompany.SalesOrderProductsHandler
的新实例吗?
文档绝对正确。有:
<component class="com.mycompany.SalesOrderProductsHandler" />
每次调用你都会得到一个新的 com.mycompany.SalesOrderProductsHandler
实例。