org.objectweb.jass.hls.ont
Class CompensatingAction

java.lang.Object
  extended byorg.objectweb.jass.hls.ont.CompensatingAction
All Implemented Interfaces:
javax.activity.coordination.Action

public class CompensatingAction
extends java.lang.Object
implements javax.activity.coordination.Action

Implements the compensating action required by the ONT model. It may receive the activity_committed and the activity_rollback signals, performing the required tasks in each case.

Author:
fran Date: Feb 12, 2004 org.objectweb.jass.hls.ontCompensatingAction.java

Constructor Summary
CompensatingAction(javax.activity.opennested.Compensator compensator, int priority)
          Constructor.
 
Method Summary
 void destroy()
          Clears the main attributes.
 javax.activity.Outcome processSignal(javax.activity.Signal signal)
          Invoked on the target object, by the AS, during signal processing.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompensatingAction

public CompensatingAction(javax.activity.opennested.Compensator compensator,
                          int priority)
Constructor.

Parameters:
compensator - - the element that compensates a previous task.
priority - - compensator priority.
Method Detail

processSignal

public javax.activity.Outcome processSignal(javax.activity.Signal signal)
                                     throws javax.activity.ActionErrorException
Invoked on the target object, by the AS, during signal processing. When the activity_committed signal is processed by a ONT action, it means that the activity has completted with success. But the compensator mantained by this action may be triggered later if other activity fails. That is why the action must promote its compensator to the parent activity. If a parent coordinator reference is found, the Action wraps its compensator in a new action that is registered with the parent. Depending on the result of the registration, the Action returns the parent_add_successful or the parent_has_completed/parent_add_failed outcomes. Else if the parent coordinator is null, the action invokes a forget operation on the compensator to inform it about the final completion and the compensation_successful outcome is returned. If the action receives the activity_rollback signal, it invokes the compensate operation on the Compensator object. If the action fails to invoke the Compensator object it returns the outcome compensation_failed.

Specified by:
processSignal in interface javax.activity.coordination.Action
Throws:
javax.activity.ActionErrorException

destroy

public void destroy()
Clears the main attributes.

Specified by:
destroy in interface javax.activity.coordination.Action