1 Reply Latest reply on May 4, 2007 9:54 AM by Robert Jackson

    Exception Handling

    Élvio Andrade Newbie

      Hi,

      I have some doubts about the exception handling mechanism and I would appreciate some help. I have defined some processes and they all follow the same philosofy, in all the nodes I have an ActionHandler that executes some logic. They all look like this:

       <node name="node5">
       <action class="Node5ActionHandler"/>
       <exception-handler>
       <action class="ExceptionHandler"/>
       </exception-handler>
       <transition name="OK" to="end" />
       <transition name="ERROR" to="CREATE_ERROR_NOTIFICATION"/>
       </node>
      
      
       <node name="CREATE_ERROR_NOTIFICATION">
       <action class="CreateErrorNotificationActionHandler"/>
       <transition name="OK" to="end" />
       </node>
      


      Basically the exception-handler signals the token to take the ERROR transition in all nodes. The code looks like this:

      public class ExceptionHandler implements ActionHandler {
      
       public void execute(ExecutionContext executionContext) throws Exception {
      
       executionContext.getToken().signal(ERROR);
      
       }
      }
      


      So the normal execution of the process always takes the OK transition, if an exception occurs, then the exception-handler re-directs the execution into the ERROR transition. It is working but one problem is bothering me, when the exception handler re-directs the execution, it goes as planned into the node specified in the ERROR transition, and then it reaches the end node, the problem is that the entity that first started the process hangs and it seems like the process never ends.

      I wonder if I am giving an abnormal behaviour to the exception-handler, maybe I shouldn't do the token.signal("ERROR"). The manual says:


      Note that in an action that handles an exception, it is possible to put the token in an arbitrary node in the graph with Token.setNode(Node node).


      but I don't know if I am allowed to signal the token!

      Can anyone clarify me?

      best regards