/** * Handle the committed event. * @param committed The committed notification. * @param map The addressing context. * @param arjunaContext The arjuna context. * * None -> None (ignore) * Active -> Aborting (invalid state) * Preparing -> Aborting (invalid state) * PreparedSuccess -> PreparedSuccess (invalid state) * Committing -> Committing (forget) * Aborting -> Aborting (invalid state) */ public synchronized void committed(final Notification committed, final MAP map, final ArjunaContext arjunaContext) { final State current = state ; if (current == State.STATE_ACTIVE) { changeState(State.STATE_ABORTING) ; } else if ((current == State.STATE_PREPARING) || (current == State.STATE_COMMITTING)) { forget() ; } }
/** * Handle the committed event. * @param committed The committed notification. * @param map The addressing context. * @param arjunaContext The arjuna context. * * None -> None (ignore) * Active -> Aborting (invalid state) * Preparing -> Aborting (invalid state) * PreparedSuccess -> PreparedSuccess (invalid state) * Committing -> Committing (forget) * Aborting -> Aborting (invalid state) */ public synchronized void committed(final Notification committed, final MAP map, final ArjunaContext arjunaContext) { final State current = state ; if (current == State.STATE_ACTIVE) { changeState(State.STATE_ABORTING) ; } else if ((current == State.STATE_PREPARING) || (current == State.STATE_COMMITTING)) { forget() ; } }
/** * Handle the aborted event. * @param aborted The aborted notification. * @param map The addressing context. * @param arjunaContext The arjuna context. * * None -> None (ignore) * Active -> Aborting (forget) * Preparing -> Aborting (forget) * PreparedSuccess -> PreparedSuccess (invalid state) * Committing -> Committing (invalid state) * Aborting -> Aborting (forget) */ public synchronized void aborted(final Notification aborted, final MAP map, final ArjunaContext arjunaContext) { final State current = state ; if (current == State.STATE_ACTIVE) { changeState(State.STATE_ABORTING) ; } else if ((current == State.STATE_PREPARING) || (current == State.STATE_ABORTING)) { forget() ; } }
/** * Handle the aborted event. * @param aborted The aborted notification. * @param map The addressing context. * @param arjunaContext The arjuna context. * * None -> None (ignore) * Active -> Aborting (forget) * Preparing -> Aborting (forget) * PreparedSuccess -> PreparedSuccess (invalid state) * Committing -> Committing (invalid state) * Aborting -> Aborting (forget) */ public synchronized void aborted(final Notification aborted, final MAP map, final ArjunaContext arjunaContext) { final State current = state ; if (current == State.STATE_ACTIVE) { changeState(State.STATE_ABORTING) ; } else if ((current == State.STATE_PREPARING) || (current == State.STATE_ABORTING)) { forget() ; } }
/** * Handle the aborted event. * @param aborted The aborted notification. * @param map The addressing context. * @param arjunaContext The arjuna context. * * None -> None (ignore) * Active -> Aborting (forget) * Preparing -> Aborting (forget) * PreparedSuccess -> PreparedSuccess (invalid state) * Committing -> Committing (invalid state) * Aborting -> Aborting (forget) */ public synchronized void aborted(final Notification aborted, final MAP map, final ArjunaContext arjunaContext) { final State current = state ; if (current == State.STATE_ACTIVE) { changeState(State.STATE_ABORTING) ; } else if ((current == State.STATE_PREPARING) || (current == State.STATE_ABORTING)) { forget() ; } }
/** * Handle the committed event. * @param committed The committed notification. * @param map The addressing context. * @param arjunaContext The arjuna context. * * None -> None (ignore) * Active -> Aborting (invalid state) * Preparing -> Aborting (invalid state) * PreparedSuccess -> PreparedSuccess (invalid state) * Committing -> Committing (forget) * Aborting -> Aborting (invalid state) */ public synchronized void committed(final Notification committed, final MAP map, final ArjunaContext arjunaContext) { final State current = state ; if (current == State.STATE_ACTIVE) { changeState(State.STATE_ABORTING) ; } else if ((current == State.STATE_PREPARING) || (current == State.STATE_COMMITTING)) { forget() ; } }
/** * Forget the current coordinator. */ private void forget() { // first, change state to null to indicate that the participant has completed. changeState(null) ; // participants which have not been recovered from the log can be deactivated now. // participants which have been recovered are left for the recovery thread to deactivate. // this is because the recovery thread may have timed out waiting for a response to // the commit message and gone on to complete its scan and suspend. the next scan // will detect this activated participant and note that it has completed. if a crash // happens in between the recovery thread can safely recreate and reactivate the // participant and resend the commit since the commit/committed exchange is idempotent. if (!recovered) { CoordinatorProcessor.getProcessor().deactivateCoordinator(this) ; } }
/** * Forget the current coordinator. */ private void forget() { // first, change state to null to indicate that the participant has completed. changeState(null) ; // participants which have not been recovered from the log can be deactivated now. // participants which have been recovered are left for the recovery thread to deactivate. // this is because the recovery thread may have timed out waiting for a response to // the commit message and gone on to complete its scan and suspend. the next scan // will detect this activated participant and note that it has completed. if a crash // happens in between the recovery thread can safely recreate and reactivate the // participant and resend the commit since the commit/committed exchange is idempotent. if (!recovered) { CoordinatorProcessor.getProcessor().deactivateCoordinator(this) ; } }
/** * Forget the current coordinator. */ private void forget() { // first, change state to null to indicate that the participant has completed. changeState(null) ; // participants which have not been recovered from the log can be deactivated now. // participants which have been recovered are left for the recovery thread to deactivate. // this is because the recovery thread may have timed out waiting for a response to // the commit message and gone on to complete its scan and suspend. the next scan // will detect this activated participant and note that it has completed. if a crash // happens in between the recovery thread can safely recreate and reactivate the // participant and resend the commit since the commit/committed exchange is idempotent. if (!recovered) { CoordinatorProcessor.getProcessor().deactivateCoordinator(this) ; } }
if (current == State.STATE_ACTIVE) changeState(State.STATE_PREPARING) ;
if (current == State.STATE_ACTIVE) changeState(State.STATE_PREPARING) ;
if (current == State.STATE_ACTIVE) changeState(State.STATE_PREPARING) ;
if (current == State.STATE_ACTIVE) changeState(State.STATE_ABORTING) ; changeState(State.STATE_PREPARED_SUCCESS) ;
if (current == State.STATE_ACTIVE) changeState(State.STATE_ABORTING) ; changeState(State.STATE_PREPARED_SUCCESS) ;
(current == State.STATE_PREPARED_SUCCESS)) changeState(State.STATE_ABORTING) ;
if (current == State.STATE_PREPARED_SUCCESS) changeState(State.STATE_COMMITTING) ;
(current == State.STATE_PREPARED_SUCCESS)) changeState(State.STATE_ABORTING) ;
(current == State.STATE_PREPARED_SUCCESS)) changeState(State.STATE_ABORTING) ;
if (current == State.STATE_PREPARED_SUCCESS) changeState(State.STATE_COMMITTING) ;
if (current == State.STATE_PREPARED_SUCCESS) changeState(State.STATE_COMMITTING) ;