3 Replies Latest reply on Aug 13, 2008 2:36 PM by Ronald van Kuijk

    Task Node Question - How to end blocking tasks

    Steve Hall Newbie

      I could use some help with how to end or close blocking tasks in a task node. Here is my scenario:

      I an able to successfully move a token through the nodes in my workflow using the processinstance.signal method. The process has 4 nodes named START, R, S, END. Node R is a task node. A simple test of the work flow works fine. I can move the token through the work flow using the signal method as shown in the examples.

      After this initial test, I added a single task to the R task node. The new task is named AssignMacAddress. AssignMacAddress is blocking and signalling. I can see that the process moves through the AssignMacAddress task and calls methods for the assignment and controller classes I have associated to it.

      Now when I attempt to signal to move from node r to node s, I get java.lang.IllegalStateException: task-node 'R' still has blocking tasks.

      My question is how do I end or close the blocking AssignMacAddress task so that the process is able to move from node r to s without throwing the error? I have tried a number of approaches, none of them work.

      Thanks in advance.
      Steve

        • 1. Re: Task Node Question - How to end blocking tasks
          Ronald van Kuijk Master

           

          I have tried a number of approaches, none of them work.

          What have you tried? Asking politely? Shouting? Commanding? Begging? All of the above?

          for task nodes just not signal the node but the task.. look at the testcases in the source how that is done, or simple deduce from the api

          • 2. Re: Task Node Question - How to end blocking tasks
            Steve Hall Newbie

            After some additonal effort, I did get this to work.

            Users who are new to JBPM and have some database background can discern quite alot by looking at the database tables. In my case, this helped me find that I had two task instances: one in my model and one that I had been creating in code. Removing one of them was the first step in solving my problem.

            Next, while we can step through nodes using RootToken.signal(), this does not seem to step us through the tasks in a task node. When working with tasks in a task node, it seems that it's best to use taskInstance.start() and taskInstance.end().

            Finally, when working with blocking tasks in a task node named foo, it seems that one must get an instance of the task and use setBlocking(false) to avoid getting an IllegalStateException: task-node 'foo' still has blocking tasks when attempting to exit task node foo. This seems a bit weird to me, since it seems to imply that I am changing the model. I would have thought that starting and ending the task would have been adequate to allow movement through the graph. But, setting blocking to false was the only way I found to allow graph execution to proceed.

            If anyone has other ideas, I would like to hear them.

            • 3. Re: Task Node Question - How to end blocking tasks
              Ronald van Kuijk Master

              please provide a unit test that demonstrates the problem (without the workarounds)