AnsweredAssumed Answered

Service Task (JavaTaskDelegate) are implemented as Singleton ?

Question asked by hardiku on Aug 11, 2014
Latest reply on Aug 11, 2014 by frederikheremans1
Hi,

I am using Activiti 5.16. While reading documentation of service task i found one note about service task instances
"Note: there will be only one instance of that Java class created for the serviceTask it is defined on. All process-instances share the same class instance that will be used to call execute(DelegateExecution). This means that the class must not use any member variables and must be thread-safe, since it can be executed simultaneously from different threads. This also influences the way Field injection is handled. "

It confuses me. Looking at the code (DefaultActivitiBehaviour.java) it looks like Activiti creates service task instances for each task node definition. Does the above note means javaDelegates are implemented as Singleton ?

If so i think it takes away all the benefits of having custom service tasks per process definition.

Or am just thinking in all the wrong way ?

Outcomes