<?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 Is it safe to keep state in Java delegates? in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/is-it-safe-to-keep-state-in-java-delegates/m-p/152109#M106786</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a use case where I need to reaccess an expression when signaling out of a delegate. Since the signal method does not have the ActivityExecution instance to get the values of an expression, I am thinking of setting the values in a member variable and access it when signaling. Something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;public class MyTaskDelegate extends BaseTaskDelegate {&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; private Logger logger = LoggerFactory.getLogger(SymphonyTaskDelegate.class);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; private Expression inVariables;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; private Expression outVariables;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; private String outVariablesStr;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;public void execute(ActivityExecution execution) throws Exception {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; /*Do something*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; outVariablesStr = outVariables..getValue(execution);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;public void signal(ActivityExecution execution, String signalName, Object signalData)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throws Exception {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*READ outVariablesStr*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (outVariablesStr != null) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*Do Something*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; leave(execution);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this doable? Can I rely on the delegate state being saved, even if say, I restart the activiti server after execute and before signal?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Sep 2013 23:05:03 GMT</pubDate>
    <dc:creator>jorell</dc:creator>
    <dc:date>2013-09-25T23:05:03Z</dc:date>
    <item>
      <title>Is it safe to keep state in Java delegates?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/is-it-safe-to-keep-state-in-java-delegates/m-p/152109#M106786</link>
      <description>I have a use case where I need to reaccess an expression when signaling out of a delegate. Since the signal method does not have the ActivityExecution instance to get the values of an expression, I am thinking of setting the values in a member variable and access it when signaling. Something like&lt;IMG id="smileytongue" class="emoticon emoticon-smileytongue" src="https://migration33.stage.lithium.com/i/smilies/16x16_smiley-tongue.png" alt="Smiley Tongue" title="Smiley Tongue" /&gt;u</description>
      <pubDate>Wed, 25 Sep 2013 23:05:03 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/is-it-safe-to-keep-state-in-java-delegates/m-p/152109#M106786</guid>
      <dc:creator>jorell</dc:creator>
      <dc:date>2013-09-25T23:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: Is it safe to keep state in Java delegates?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/is-it-safe-to-keep-state-in-java-delegates/m-p/152110#M106787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Actually signal does have access to the ActivityExecution instance, my usecase is to call a different method before signalling. This method needs to access 'outVariablesStr' in the above code.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Sep 2013 23:55:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/is-it-safe-to-keep-state-in-java-delegates/m-p/152110#M106787</guid>
      <dc:creator>jorell</dc:creator>
      <dc:date>2013-09-25T23:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: Is it safe to keep state in Java delegates?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/is-it-safe-to-keep-state-in-java-delegates/m-p/152111#M106788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;No: java delegates are statesless. That is the reason why we only allow for expressions: the expression *definition* is injected in the delegate, and evaluated at runtime. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you inject a String into a delegate, it will be widely know to all delegates (because there is only one)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Sep 2013 06:24:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/is-it-safe-to-keep-state-in-java-delegates/m-p/152111#M106788</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2013-09-30T06:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: Is it safe to keep state in Java delegates?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/is-it-safe-to-keep-state-in-java-delegates/m-p/152112#M106789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Got it. Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Sep 2013 23:22:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/is-it-safe-to-keep-state-in-java-delegates/m-p/152112#M106789</guid>
      <dc:creator>jorell</dc:creator>
      <dc:date>2013-09-30T23:22:19Z</dc:date>
    </item>
  </channel>
</rss>

