Hi,
I am reading through the ServiceTask documentation about field injection and thread safety, and there seems to be a contradiction in what is written.
At Open Source it says:
Note: there will be only one instance of the Java class created for the serviceTask on which it is defined. 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, as it can be executed simultaneously from different threads. This also influences the way Field injection is handled.
and then later at Open Source it says that:
With the flowable:class attribute, using field injection is always thread safe. For each service task that references a certain class, a new instance will be instantiated and fields will be injected once when the instance is created. Reusing the same class multiple times in different tasks or process definitions is no problem.
If I have not misunderstood something it seems to say both that a single instance is created and a new instance is created every time.
Is there a mistake here, or what is the actual behaviour for the flowable:class
attribute?
Thanks,
Paul