* Exiting -> Exiting (invalid state)
* Ended -> Ended (send Compensated)
*/
public void compensate(final NotificationType compensate, final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
{
final State current ;
synchronized(this)
{
current = state ;
if (current == State.STATE_COMPLETED)
{
changeState(State.STATE_COMPENSATING) ;
}
}
if (current == State.STATE_COMPLETED)
{
if (timerTask != null)
{
timerTask.cancel() ;
}
executeCompensate() ;
}
else if (current == State.STATE_FAILING_COMPENSATING)
{
sendFail(current.getValue()) ;
}
else if (current == State.STATE_ENDED)
{
sendCompensated() ;
}