Reputation: 1187
An excerpt from this http://www.mulesoft.org/documentation/display/current/Configuring+Java+Components is:
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
And, I have configured a Java class as Mule Java component like below:
<component class="com.mycompany.SalesOrderProductsHandler" doc:name="Java" />
. The class SalesOrderProductsHandler
has implemented org.mule.api.lifecycle.Callable
and has one state variable named targetProductsIndex.
My question follows:
Will a new instance of com.mycompany.SalesOrderProductsHandler
get created every time a new request comes?
Upvotes: 1
Views: 669
Reputation: 33413
The documentation is absolutely correct. With:
<component class="com.mycompany.SalesOrderProductsHandler" />
you will get a new instance of com.mycompany.SalesOrderProductsHandler
for each invocation.
Upvotes: 1