public synchronized void error () throws SystemException { participant.cancel() ; }
if ((current == State.STATE_CANCELING_COMPLETING) || (current == State.STATE_COMPLETING)) changeState(State.STATE_COMPLETED) ; ended() ; sendClose() ; sendCompensate() ; sendInvalidStateFault() ;
(current == State.STATE_CANCELING_COMPLETING)) changeState(State.STATE_NOT_COMPLETING) ; ended(); executeCannotComplete() ; sendNotCompleted() ;
(current == State.STATE_CANCELING_COMPLETING) || (current == State.STATE_COMPLETING)) changeState(State.STATE_EXITING) ; (current == State.STATE_CANCELING_COMPLETING) || (current == State.STATE_COMPLETING)) executeExit() ; sendExited() ;
if (current == State.STATE_ACTIVE) changeState(State.STATE_FAILING_ACTIVE) ; ended(); ended(); ended(); executeFail(fail.getExceptionIdentifier()) ; (current == State.STATE_ENDED)) sendFailed() ;
final CoordinatorCompletionCoordinatorEngine engine = new CoordinatorCompletionCoordinatorEngine(id, participantProtocolService) ; BusinessAgreementWithCoordinatorCompletionImple participant = new BusinessAgreementWithCoordinatorCompletionImple( new BusinessAgreementWithCoordinatorCompletionStub(engine), id); engine.setCoordinator(participant.participantManager()) ;
if (current == State.STATE_ACTIVE) changeState(State.STATE_COMPLETING) ; sendComplete() ; waitForState(State.STATE_COMPLETING, TransportTimer.getTransportTimeout()) ;
if (current == State.STATE_ACTIVE) changeState(State.STATE_CANCELING_ACTIVE) ; changeState(State.STATE_CANCELING_COMPLETING) ; sendCancel() ; current = waitForState(State.STATE_CANCELING_ACTIVE, TransportTimer.getTransportTimeout()) ; sendCancel() ; current = waitForState(State.STATE_CANCELING_COMPLETING, TransportTimer.getTransportTimeout()) ;
if (current == State.STATE_COMPLETED) changeState(State.STATE_COMPENSATING) ; sendCompensate() ; waitForState(State.STATE_COMPENSATING, TransportTimer.getTransportTimeout()) ;
if (current == State.STATE_COMPLETED) changeState(State.STATE_CLOSING) ; sendClose() ; waitForState(State.STATE_CLOSING, TransportTimer.getTransportTimeout()) ;
/** * Send the close message. * */ private void sendClose() { final MAP map = createContext() ; try { CoordinatorCompletionParticipantClient.getClient().sendClose(participant, map, instanceIdentifier) ; } catch (final Throwable th) { if (WSTLogger.logger.isTraceEnabled()) { WSTLogger.logger.tracev("Unexpected exception while sending Close", th) ; } } }
(current == State.STATE_CANCELING_COMPLETING)) ended() ;
/** * Send the invalid state fault message. * */ private void sendInvalidStateFault() { final MAP map = createContext() ; try { final SoapFault11 soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_engines_CoordinatorCompletionCoordinatorEngine_sendInvalidStateFault_2()) ; CoordinatorCompletionParticipantClient.getClient().sendSoapFault(soapFault, participant, map, getFaultAction()) ; } catch (final Throwable th) { if (WSTLogger.logger.isTraceEnabled()) { WSTLogger.logger.tracev("Unexpected exception while sending InvalidStateFault", th) ; } } }
/** * Execute the exit transition. * */ private void executeExit() { try { coordinator.exit() ; } catch (final Throwable th) { if (WSTLogger.logger.isTraceEnabled()) { WSTLogger.logger.tracev("Unexpected exception from coordinator exit", th) ; } return ; } sendExited() ; ended() ; }
/** * Executing the cannot complete transition. * * @throws com.arjuna.webservices.SoapFault for SOAP errors. * @throws java.io.IOException for transport errors. * */ private void executeCannotComplete() { try { coordinator.cannotComplete() ; } catch (final Throwable th) { if (WSTLogger.logger.isTraceEnabled()) { WSTLogger.logger.tracev("Unexpected exception from coordinator cannotComplete", th) ; } return ; } sendNotCompleted() ; ended() ; }
/** * Executing the fail transition. * * @throws com.arjuna.webservices.SoapFault for SOAP errors. * @throws java.io.IOException for transport errors. * */ private void executeFail(final QName exceptionIdentifier) { try { coordinator.fail(exceptionIdentifier) ; } catch (final Throwable th) { if (WSTLogger.logger.isTraceEnabled()) { WSTLogger.logger.tracev("Unexpected exception from coordinator fail", th) ; } return ; } sendFailed() ; ended() ; }
participant = new CoordinatorCompletionCoordinatorEngine(id, endpointReference, state, true);
/** * End the current coordinator. */ private void ended() { changeState(State.STATE_ENDED) ; // 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 // a close/cancel 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) { CoordinatorCompletionCoordinatorProcessor.getProcessor().deactivateCoordinator(this) ; } }
public synchronized void close () throws WrongStateException, SystemException { /* * Active -> illegal state * Canceling -> illegal state * Canceling-Active -> illegal state * Canceling-Completing -> illegal state * Completing -> illegal state * Completed -> illegal state * Closing -> no response * Compensating -> illegal state * Faulting -> illegal state * Faulting-Active -> illegal state * Faulting-Compensating -> illegal state * Exiting -> illegal state * Ended -> ended */ final State state = participant.close() ; if (state == State.STATE_CLOSING) { throw new SystemException() ; } else if (state != State.STATE_ENDED) { throw new WrongStateException() ; } }
final State state = participant.compensate() ; if (state == State.STATE_COMPENSATING)