Terminating a process instance

Sometimes, it is necessary for someone with process administrator authorization to terminate a top-level process instance that is known to be in an unrecoverable state. Because a process instance terminates immediately, without waiting for any outstanding subprocesses or activities, you should terminate a process instance only in exceptional situations.

Steps for this task

  1. Retrieve the process instance that is to be terminated.
    ProcessInstanceData processInstance = 
           process.getProcessInstance("CustomerOrder");
  2. Terminate the process instance.

    If you terminate a process instance, you can terminate the process instance with or without compensation.

    To terminate the process instance with compensation:
    PIID piid = processInstance.getID();
    process.forceTerminate(piid, CompensationBehaviour.INVOKE_COMPENSATION);
    To terminate the process instance without compensation:
    PIID piid = processInstance.getID();
    process.forceTerminate(piid);

    If you terminate the process instance with compensation, the compensation handler defined for the process template is called. If the process template does not have a compensation handler defined, the default compensation handler is called. If you terminated the process instance without compensation, the process instance is terminated immediately without waiting for activities, participating tasks, or inline originating tasks to end normally.

    Applications that are started by the process and standalone tasks that are related to the process are not terminated by the force terminate request. If these applications are to be terminated, you must add statements to your process application that explicitly terminate the applications started by the process.


(c) Copyright IBM Corporation 2005, 2006.
This information center is powered by Eclipse technology (http://www.eclipse.org)