if (current == State.STATE_ACTIVE) changeState(State.STATE_CANCELING) ; executeCancel() ; sendCompleted() ; sendFail(current.getValue()) ; sendCannotComplete() ; sendExit() ; sendCancelled() ;
public synchronized void completed () throws WrongStateException, UnknownTransactionException, SystemException { // returns original state final State state = coordinator.completed() ; if ((state != State.STATE_ACTIVE) && (state != State.STATE_COMPLETED)) { throw new WrongStateException() ; } }
changeState(State.STATE_COMPLETED); initiateTimer(); return ; changeState(State.STATE_COMPLETED); initiateTimer(); sendClosed() ; ended() ;
if (current == State.STATE_ACTIVE) changeState(State.STATE_EXITING) ; sendExit() ; return waitForState(State.STATE_EXITING, timeout) ;
if (current == State.STATE_ACTIVE) changeState(State.STATE_NOT_COMPLETING) ; sendCannotComplete() ; return waitForState(State.STATE_NOT_COMPLETING, timeout) ;
if (current == State.STATE_ACTIVE) changeState(State.STATE_FAILING_ACTIVE) ; changeState(State.STATE_FAILING_CANCELING) ; changeState(State.STATE_FAILING_COMPENSATING) ; sendFail(exceptionIdentifier) ; return waitForState(State.STATE_FAILING_ACTIVE, timeout) ; sendFail(exceptionIdentifier) ; return waitForState(State.STATE_FAILING_CANCELING, timeout) ; sendFail(exceptionIdentifier) ; return waitForState(State.STATE_FAILING_COMPENSATING, timeout) ;
fail(BusinessActivityConstants.WSBA_ELEMENT_FAIL_QNAME); return; if (current == State.STATE_COMPENSATING) changeState(State.STATE_COMPLETED) ; initiateTimer() ; changeState(State.STATE_FAILING_COMPENSATING); ended(); fail(BusinessActivityConstants.WSBA_ELEMENT_FAIL_QNAME); } else if (current == State.STATE_COMPENSATING) { sendCompensated() ;
fail(BusinessActivityConstants.WSBA_ELEMENT_FAIL_QNAME); return; changeState(State.STATE_ACTIVE); sendCancelled() ; ended() ;
if (current == State.STATE_COMPLETED) changeState(State.STATE_COMPENSATING) ; executeCompensate() ; sendFail(current.getValue()) ; sendCompensated() ;
/** * Send the completed message. * * @param timedOut true if this is in response to a comms timeout */ private void sendCompleted(boolean timedOut) { final MAP map = createContext() ; try { // if we are trying to reestablish the participant state then send getStatus otherwise send completed if (timedOut && checkStatus) { ParticipantCompletionCoordinatorClient.getClient().sendGetStatus(coordinator, map, instanceIdentifier); ; } else { ParticipantCompletionCoordinatorClient.getClient().sendCompleted(coordinator, map, instanceIdentifier) ; } } catch (final Throwable th) { if (WSTLogger.logger.isTraceEnabled()) { WSTLogger.logger.tracev("Unexpected exception while sending Completed", th) ; } } // if we timed out the increase the resend period otherwise make sure it is reset to the // initial resend period updateResendPeriod(timedOut); initiateTimer() ; }
if (current == State.STATE_COMPLETED) changeState(State.STATE_CLOSING) ; executeClose() ; sendClosed() ;
changeState(State.STATE_COMPLETED); persisted = true; current = fail(BusinessActivityConstants.WSBA_ELEMENT_FAIL_QNAME); sendCompleted() ;
/** * Send the closed message. * */ private void sendClosed() { final MAP map = createContext() ; try { ParticipantCompletionCoordinatorClient.getClient().sendClosed(coordinator, map, instanceIdentifier) ; } catch (final Throwable th) { if (WSTLogger.logger.isTraceEnabled()) { WSTLogger.logger.tracev("Unexpected exception while sending Closed", th) ; } } }
/** * create a participant engine to manage commit or rollback processing for the * participant and install it in the active participants table */ public void activate() { if (isParticipantCompletion) { ParticipantCompletionParticipantEngine engine = new ParticipantCompletionParticipantEngine(id, endpoint, participant, State.STATE_COMPLETED, true); ParticipantCompletionParticipantProcessor.getProcessor().activateParticipant(engine, getId()); engine.recovery(); } else { BusinessAgreementWithCoordinatorCompletionParticipant coordinatorCompletionParticipant = (BusinessAgreementWithCoordinatorCompletionParticipant) participant; CoordinatorCompletionParticipantEngine engine = new CoordinatorCompletionParticipantEngine(id, endpoint, coordinatorCompletionParticipant, State.STATE_COMPLETED, true); CoordinatorCompletionParticipantProcessor.getProcessor().activateParticipant(engine, getId()); engine.recovery(); } }
/** * Handle the exited event. * @param exited The exited notification. * @param map The addressing context. * @param arjunaContext The arjuna context. * * Active -> Active (invalid state) * Canceling -> Canceling (invalid state) * Completed -> Completed (invalid state) * Closing -> Closing (invalid state) * Compensating -> Compensating (invalid state) * Failing-Active -> Failing-Active (invalid state) * Failing-Canceling -> Failing-Canceling (invalid state) * Failing-Compensating -> Failing-Compensating (invalid state) * NotCompleting -> NotCompleting (invalid state) * Exiting -> Ended * Ended -> Ended */ public void exited(final NotificationType exited, final MAP map, final ArjunaContext arjunaContext) { final State current ; synchronized(this) { current = state ; if (current == State.STATE_EXITING) { ended() ; } } }
final W3CEndpointReference participant = getParticipant(service, endpoint, address, id) ; W3CEndpointReference baPMEndpoint = registerParticipant(participant, BusinessActivityConstants.WSBA_SUB_PROTOCOL_PARTICIPANT_COMPLETION); final ParticipantCompletionParticipantEngine engine = new ParticipantCompletionParticipantEngine(id, baPMEndpoint, bap) ; ParticipantCompletionParticipantProcessor.getProcessor().activateParticipant(engine, id) ;
/** * End the current participant. */ private void ended() { changeState(State.STATE_ENDED) ; ParticipantCompletionParticipantProcessor.getProcessor().deactivateParticipant(this) ; }
public void cannotComplete() throws WrongStateException, UnknownTransactionException, SystemException { /* * Active -> illegal state * Canceling -> illegal state * Completed -> illegal state * Closing -> illegal state * Compensating -> illegal state * Failing-Active -> illegal state * Failing-Canceling -> illegal state * Failing-Compensating -> illegal state * NotCompleting -> no response * Exiting -> illegal state * Ended -> ended */ final State state = coordinator.cannotComplete() ; if (state == State.STATE_NOT_COMPLETING) { throw new SystemException() ; } else if (state != State.STATE_ENDED) { throw new WrongStateException() ; } }
public synchronized void exit () throws WrongStateException, UnknownTransactionException, SystemException { /* * Active -> illegal state * Canceling -> illegal state * Completed -> illegal state * Closing -> illegal state * Compensating -> illegal state * Failing-Active -> illegal state * Failing-Canceling -> illegal state * Failing-Compensating -> illegal state * NotCompleting -> illegal state * Exiting -> no response * Ended -> ended */ final State state = coordinator.exit() ; if (state == State.STATE_EXITING) { throw new SystemException() ; } else if (state != State.STATE_ENDED) { throw new WrongStateException() ; } }
fail(BusinessActivityConstants.WSBA_ELEMENT_FAIL_QNAME); return; if (current == State.STATE_COMPENSATING) changeState(State.STATE_COMPLETED) ; initiateTimer() ; changeState(State.STATE_FAILING_COMPENSATING); ended(); fail(BusinessActivityConstants.WSBA_ELEMENT_FAIL_QNAME); } else if (current == State.STATE_COMPENSATING) { sendCompensated() ;