if ((current == State.STATE_ACTIVE) || (current == State.STATE_COMPLETING)) changeState(State.STATE_CANCELING) ; executeCancel(false) ; executeCancel(true) ; sendCompleted() ; sendFail(current.getValue()) ; sendCannotComplete() ; sendExit() ; sendCancelled() ;
public 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) || (current == State.STATE_COMPLETING)) changeState(State.STATE_NOT_COMPLETING) ; (current == State.STATE_NOT_COMPLETING)) sendCannotComplete() ; return waitForState(State.STATE_NOT_COMPLETING, timeout) ;
if ((current == State.STATE_ACTIVE) || (current == State.STATE_COMPLETING)) changeState(State.STATE_EXITING) ; (current == State.STATE_EXITING)) sendExit() ; return waitForState(State.STATE_EXITING, timeout) ;
if (current == State.STATE_ACTIVE) changeState(State.STATE_FAILING_ACTIVE) ; changeState(State.STATE_FAILING_CANCELING) ; changeState(State.STATE_FAILING_COMPLETING) ; 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_COMPLETING, timeout) ; sendFail(exceptionIdentifier) ; return waitForState(State.STATE_FAILING_COMPENSATING, timeout) ;
if (current == State.STATE_ACTIVE) changeState(State.STATE_COMPLETING) ; executeComplete() ; sendCompleted() ; sendFail(current.getValue()) ; sendCannotComplete() ; sendExit() ;
fail(BusinessActivityConstants.WSBA_ELEMENT_FAIL_QNAME) ; 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() ;
if (current == State.STATE_COMPLETING) { if (!failRequired) { changeState(State.STATE_COMPLETED); changeState(State.STATE_FAILING_COMPLETING); current = fail(BusinessActivityConstants.WSBA_ELEMENT_FAIL_QNAME); sendCompleted() ;
if (current == State.STATE_COMPLETED) changeState(State.STATE_COMPENSATING) ; executeCompensate() ; sendFail(current.getValue()) ; sendCompensated() ;
fail(BusinessActivityConstants.WSBA_ELEMENT_FAIL_QNAME); if (duringComplete) { failRequired = true; changeState(State.STATE_FAILING_CANCELING); } else { changeState(State.STATE_ACTIVE); return; fail(BusinessActivityConstants.WSBA_ELEMENT_FAIL_QNAME); } else { sendCancelled() ; ended() ;
/** * 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) { CoordinatorCompletionCoordinatorClient.getClient().sendGetStatus(coordinator, map, instanceIdentifier); ; } else { CoordinatorCompletionCoordinatorClient.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() ;
/** * Send the exit message. * */ private void sendExit() { final MAP map = createContext() ; try { CoordinatorCompletionCoordinatorClient.getClient().sendExit(coordinator, map, instanceIdentifier) ; } catch (final Throwable th) { if (WSTLogger.logger.isTraceEnabled()) { WSTLogger.logger.tracev("Unexpected exception while sending Exit", 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(); } }
if (current == State.STATE_NOT_COMPLETING) ended() ;
final W3CEndpointReference participant = getParticipant(service, endpoint, address, id) ; W3CEndpointReference baPMEndpoint = registerParticipant(participant, BusinessActivityConstants.WSBA_SUB_PROTOCOL_COORDINATOR_COMPLETION); final CoordinatorCompletionParticipantEngine engine = new CoordinatorCompletionParticipantEngine(id, baPMEndpoint, bawcp) ; CoordinatorCompletionParticipantProcessor.getProcessor().activateParticipant(engine, id) ;
/** * End the current participant. */ private void ended() { changeState(State.STATE_ENDED) ; CoordinatorCompletionParticipantProcessor.getProcessor().deactivateParticipant(this) ; }
public void cannotComplete() throws WrongStateException, UnknownTransactionException, SystemException { /* * Active -> illegal state * Canceling -> illegal state * Completing -> illegal state * Completed -> illegal state * Closing -> illegal state * Compensating -> illegal state * Failing-Active -> illegal state * Failing-Canceling -> illegal state * Failing-Completing -> 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() ; } }
if (current == State.STATE_ACTIVE) changeState(State.STATE_COMPLETING) ; executeComplete() ; sendCompleted() ; sendFail(current.getValue()) ; sendCannotComplete() ; sendExit() ;