Mule Java组件和线程安全

时间:2015-01-28 18:22:07

标签: multithreading mule

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类配置为Mule Java组件,如下所示:

<component class="com.mycompany.SalesOrderProductsHandler" doc:name="Java" />。课程SalesOrderProductsHandler已实施org.mule.api.lifecycle.Callable,并且有一个名为 targetProductsIndex 的状态变量。

我的问题如下:

每次新请求到来时都会创建com.mycompany.SalesOrderProductsHandler的新实例吗?

1 个答案:

答案 0 :(得分:1)

文档绝对正确。用:

<component class="com.mycompany.SalesOrderProductsHandler" />

每次调用都会获得com.mycompany.SalesOrderProductsHandler的新实例。