<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Thread Safeness of Java Service Task in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/thread-safeness-of-java-service-task/m-p/224537#M177667</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, using Expressions is thread safe. The Expression is actually only set once, on delegate instantiation. In the method, the expression.getValue(execution) is used later on, which can happen concurrently without problems.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Variables are thread safe only if you are not doing any async steps. Otherwise, regular async rules apply and the order can be anything.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 May 2016 10:35:14 GMT</pubDate>
    <dc:creator>jbarrez</dc:creator>
    <dc:date>2016-05-10T10:35:14Z</dc:date>
    <item>
      <title>Thread Safeness of Java Service Task</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/thread-safeness-of-java-service-task/m-p/224534#M177664</link>
      <description>Hello everybody,we're using the Activiti engine for a while now in our enterprise application. Some of our Java Service Tasks are completely identical from the perspective of the source code. Their particular behavior just depends on the expressions injected via the &amp;lt;extensionElements&amp;gt; mechani</description>
      <pubDate>Mon, 09 May 2016 13:58:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/thread-safeness-of-java-service-task/m-p/224534#M177664</guid>
      <dc:creator>timo_rohrberg</dc:creator>
      <dc:date>2016-05-09T13:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Thread Safeness of Java Service Task</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/thread-safeness-of-java-service-task/m-p/224535#M177665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We ran into a similar issue. We worked around it by moving these private variables out to workflow variables. After that JavaDelegates might as well become spring beans and they'll be perfectly thread safe.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2016 22:29:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/thread-safeness-of-java-service-task/m-p/224535#M177665</guid>
      <dc:creator>sankalpn</dc:creator>
      <dc:date>2016-05-09T22:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Thread Safeness of Java Service Task</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/thread-safeness-of-java-service-task/m-p/224536#M177666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;well, moving the one variable out to workflow variables is not an option for us since the value of those variable is injected as a fixed value from the workflow model bpmn and not when actually starting the workflow.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Background: We're using Activiti in an OSGi-based application and provide the actual operations to be executed as Service Tasks as OSGi services. Since Activiti does not know anything about OSGi an cannot execute OSGi services directly, we built a bridge as a Java Service Task which gets the actual OSGi service to execute injected from the workflow model bpmn. That Bridge is then used as the Java Service Task class in all our Java Service Tasks. We now have to make sure that there are no race conditions on the injected variable holding the actual OSGi service to be executed since that would lead to the execution of the wrong OSGi service.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Furthermore, are workflow variables always really thread safe? We encountered a situation in which we diagnosed a race condition on the workflow variables, but were not able to reproduce that situation reliably. Is it absolutely sure to assume that all workflow variables are 100% thread safe?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We appreciate any further comment.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Timo Rohrberg&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 May 2016 06:40:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/thread-safeness-of-java-service-task/m-p/224536#M177666</guid>
      <dc:creator>timo_rohrberg</dc:creator>
      <dc:date>2016-05-10T06:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: Thread Safeness of Java Service Task</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/thread-safeness-of-java-service-task/m-p/224537#M177667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, using Expressions is thread safe. The Expression is actually only set once, on delegate instantiation. In the method, the expression.getValue(execution) is used later on, which can happen concurrently without problems.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Variables are thread safe only if you are not doing any async steps. Otherwise, regular async rules apply and the order can be anything.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 May 2016 10:35:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/thread-safeness-of-java-service-task/m-p/224537#M177667</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2016-05-10T10:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Thread Safeness of Java Service Task</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/thread-safeness-of-java-service-task/m-p/224538#M177668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thank you for your further explanation. That helps us a lot to be sure that we don't have a sleeping problem of race conditions through threading issues. I just have to further questions on that issue…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) When examining the source code of Activiti, I noticed that there are actually two implementations of the org.activiti.engine.delegate.Expression, the org.activiti.engine.impl.el.FixedValue, and the org.activiti.engine.impl.el.JuelExpression. While the latter one seems to really do something with the passed VariableScope in the getValue() method, the first one does not use it at all. That appeared somehow weired to me related to the consideration of having thread issues. But then I figured that the name actually already suggests how it is handled. Since it's a fixed value, instances of org.activiti.engine.impl.el.FixedValue probably exists only once per workflow deployment and are shared amongst all process instances. Is that right?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) In our class implementing the Java Service Task, which is shared amongst almost all Service Task elements in our workflow models, we are passing the map of process variables (retrieved from the DelegateExecution via the method getVariables()) to the OSGi service actually implementing the according task. Is that passing thread-safe, too? It should be right, because it's just a passing of a reference to a map and that map should exist per execution… Can you please confirm that thinking?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again for your hints.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Timo Rohrberg&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 May 2016 06:30:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/thread-safeness-of-java-service-task/m-p/224538#M177668</guid>
      <dc:creator>timo_rohrberg</dc:creator>
      <dc:date>2016-05-11T06:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Thread Safeness of Java Service Task</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/thread-safeness-of-java-service-task/m-p/224539#M177669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;@Timo: did you see this issue &lt;/SPAN&gt;&lt;A href="https://github.com/Activiti/Activiti/issues/890" rel="nofollow noopener noreferrer"&gt;https://github.com/Activiti/Activiti/issues/890&lt;/A&gt;&lt;SPAN&gt;? I think it is exactly what you're talking about&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) The one with .delegate in it is the one you should use. The other one will be removed in the future (and is already removed in v6)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) That is thread-safe, but it could be that you have multiple nodes working on the same variables of course … in that case it's not really 'safe'&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 May 2016 16:02:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/thread-safeness-of-java-service-task/m-p/224539#M177669</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2016-05-18T16:02:43Z</dc:date>
    </item>
  </channel>
</rss>

