3 Replies Latest reply on Jun 2, 2006 8:48 AM by Ronald van Kuijk

    end-tasks attribute on task-node causes ALL task instances t

    Michael Holtzman Newbie

      Greetings.

      When the "end-tasks" attribute is set to true leaving the task-node causes all pending tasks to end, even tasks that are associated with different nodes.

       public void removeTaskInstanceSynchronization(Token token) {
       TaskMgmtInstance tmi = getTaskMgmtInstance(token);
       Collection taskInstances = tmi.getTaskInstances();
       if (taskInstances!=null) {
       Iterator iter = taskInstances.iterator();
       while (iter.hasNext()) {
       TaskInstance taskInstance = (TaskInstance) iter.next();
       // remove signalling
       if (taskInstance.isSignalling()
       &&(token==taskInstance.getToken())) {
       taskInstance.setSignalling(false);
       }
       // remove blocking
       if (taskInstance.isBlocking()
       &&(token==taskInstance.getToken())) {
       taskInstance.setBlocking(false);
       }
       // if this is a non-finished task and all those
       // tasks should be finished
       if ( (! taskInstance.hasEnded())
       && (endTasks)
       ) {
       // end this task
       taskInstance.end();
       }
       }
       }
       }
      


      You'll notice that for resetting "signalling" and "blocking" there is a check for the current token, but "endTasks" just ends the task instance. Perhaps a check for the current token should enclose all the attribute processing?

       public void removeTaskInstanceSynchronization(Token token) {
       TaskMgmtInstance tmi = getTaskMgmtInstance(token);
       Collection taskInstances = tmi.getTaskInstances();
       if (taskInstances!=null) {
       Iterator iter = taskInstances.iterator();
       while (iter.hasNext()) {
       TaskInstance taskInstance = (TaskInstance) iter.next();
       if (token==taskInstance.getToken()) {
       // remove signalling
       if (taskInstance.isSignalling()) {
       taskInstance.setSignalling(false);
       }
       // remove blocking
       if (taskInstance.isBlocking()) {
       taskInstance.setBlocking(false);
       }
       // if this is a non-finished task and all those
       // tasks should be finished
       if ( (! taskInstance.hasEnded())
       && (endTasks)
       ) {
       // end this task
       taskInstance.end();
       }
       }
       }
       }
       }
      



      Anyway, this appears to be a bug.