1 Reply Latest reply on Jan 12, 2007 12:52 PM by kukeltje

    Custom Action setting variables

    leobaz2

      Hello,

      I have a custom action (extending ActionHandler) that creates a new Thread. Inside this thread I am setting a variable using:

      executionContext.getContextInstance().setVariable(name, value);

      The problem I am seeing is that this variable is never set or seen by the other tasks. Am I doing something wrong or is setting a variable is a new Thread just not supported?

      Regards,
      Barry

        • 1. Re: Custom Action setting variables
          kukeltje

           

          "leobaz2" wrote:
          Hello,

          I have a custom action (extending ActionHandler) that creates a new Thread.



          Don't do this. it is not allowed to start new threads from a java class. Use jbpm async functionality for this.

          "leobaz2" wrote:


          Inside this thread I am setting a variable using:

          executionContext.getContextInstance().setVariable(name, value);

          The problem I am seeing is that this variable is never set or seen by the other tasks. Am I doing something wrong or is setting a variable is a new Thread just not supported?



          Yes, you do something wrong. The variables are only persisted when you leave the actionhandler.