/** * create a participant engine to manage commit or rollback processing for the * participant and install it in the active participants table */ public void activate() { ParticipantEngine engine = new ParticipantEngine(participant, id, State.STATE_PREPARED_SUCCESS, endpoint, true); ParticipantProcessor.getProcessor().activateParticipant(engine, getId()); engine.recovery(); }
executePrepare() ; sendPrepared() ; sendAborted() ; forget() ;
/** * Handle the readOnly decision event. * * Active -> None (send ReadOnly) * Preparing -> None (send ReadOnly) */ private void readOnlyDecision() { final State current ; synchronized(this) { current = state ; if ((current == State.STATE_ACTIVE) || (current == State.STATE_PREPARING)) { state = null ; } } if ((current == State.STATE_ACTIVE) || (current == State.STATE_PREPARING)) { sendReadOnly() ; forget() ; } }
/** * Handle the rollback decision event. * * Active -> Aborting (send aborted) * Preparing -> Aborting (send aborted) */ private void rollbackDecision() { final State current ; synchronized(this) { current = state ; if ((current == State.STATE_PREPARING) || (current == State.STATE_ACTIVE)) { state = State.STATE_ABORTING ; } } if ((current == State.STATE_PREPARING) || (current == State.STATE_ACTIVE)) { sendAborted() ; forget() ; } }
executeRollback(); sendAborted(); forget(); } else if (deleteRequired) { sendPrepared() ; sendCommitted() ; forget() ;
/** * Send the prepared message. * * @param timedOut true if this is in response to a comms timeout */ private void sendPrepared(boolean timedOut) { final MAP responseAddressingContext = createContext() ; final InstanceIdentifier instanceIdentifier = new InstanceIdentifier(id) ; try { CoordinatorClient.getClient().sendPrepared(coordinator, responseAddressingContext, instanceIdentifier) ; } catch (final Throwable th) { if (WSTLogger.logger.isTraceEnabled()) { WSTLogger.logger.tracev("Unexpected exception while sending Prepared", th) ; } } updateResendPeriod(timedOut); initiateTimer() ; }
rollbackDecision() ; return ; commitDecision() ; readOnlyDecision() ; rollbackDecision() ; rollbackDecision() ;
if (!executeRollback()) sendAborted() ; forget() ; sendAborted();
public void enlistForDurableTwoPhase (Durable2PCParticipant tpp, String id) throws WrongStateException, UnknownTransactionException, SystemException { try { final W3CEndpointReference participant = getParticipant(id, isCurrentContextSecure()); final W3CEndpointReference coordinator = registerParticipant(participant, AtomicTransactionConstants.WSAT_SUB_PROTOCOL_DURABLE_2PC); ParticipantProcessor.getProcessor().activateParticipant(new ParticipantEngine(tpp, id, coordinator), id) ; } catch (com.arjuna.wsc.InvalidProtocolException ex) { throw new SystemException(ex.toString()); } catch (com.arjuna.wsc.InvalidStateException ex) { throw new WrongStateException(); } catch (com.arjuna.wsc.CannotRegisterException ex) { // cause could actually be no activity or already registered throw new UnknownTransactionException(); } }
AtomicTransactionConstants.WSAT_ERROR_CODE_UNKNOWN_TRANSACTION_QNAME.equals(subcode)) { executeRollback(); forget() ;
/** * Send the committed message. * */ private void sendCommitted() { final MAP responseAddressingContext = createContext() ; final InstanceIdentifier instanceIdentifier = new InstanceIdentifier(id) ; try { CoordinatorClient.getClient().sendCommitted(coordinator, responseAddressingContext, instanceIdentifier) ; } catch (final Throwable th) { if (WSTLogger.logger.isTraceEnabled()) { WSTLogger.logger.tracev("Unexpected exception while sending Committed", th) ; } } }
/** * Handle the early readonly event. * * None -> None * Active -> None (send ReadOnly) * Preparing -> None (send ReadOnly) * PreparedSuccess -> PreparedSuccess * Committing -> Committing * Aborting -> Aborting */ public void earlyReadonly() { readOnlyDecision() ; }
/** * Execute the commit transition. * */ private void executeCommit() { try { participant.commit() ; commitDecision() ; } catch (final Throwable th) { synchronized(this) { if (state == State.STATE_COMMITTING) { state = State.STATE_PREPARED_SUCCESS ; } } if (WSTLogger.logger.isTraceEnabled()) { WSTLogger.logger.tracev("Unexpected exception from participant commit", th) ; } } }
executeRollback(); sendAborted(); forget(); } else if (deleteRequired) { sendPrepared() ; sendCommitted() ; forget() ;
/** * Send the prepared message. * * @param timedOut true if this is in response to a comms timeout */ private void sendPrepared(boolean timedOut) { final MAP responseAddressingContext = createContext() ; final InstanceIdentifier instanceIdentifier = new InstanceIdentifier(id) ; try { CoordinatorClient.getClient().sendPrepared(coordinator, responseAddressingContext, instanceIdentifier) ; } catch (final Throwable th) { if (WSTLogger.logger.isTraceEnabled()) { WSTLogger.logger.tracev("Unexpected exception while sending Prepared", th) ; } } updateResendPeriod(timedOut); initiateTimer() ; }
rollbackDecision() ; return ; commitDecision() ; readOnlyDecision() ; rollbackDecision() ; rollbackDecision() ;
if (!executeRollback()) sendAborted() ; forget() ; sendAborted();
public void enlistForDurableTwoPhase (Durable2PCParticipant tpp, String id) throws WrongStateException, UnknownTransactionException, SystemException { try { final W3CEndpointReference participant = getParticipant(id, isCurrentContextSecure()); final W3CEndpointReference coordinator = registerParticipant(participant, AtomicTransactionConstants.WSAT_SUB_PROTOCOL_DURABLE_2PC); ParticipantProcessor.getProcessor().activateParticipant(new ParticipantEngine(tpp, id, coordinator), id) ; } catch (com.arjuna.wsc.InvalidProtocolException ex) { throw new SystemException(ex.toString()); } catch (com.arjuna.wsc.InvalidStateException ex) { throw new WrongStateException(); } catch (com.arjuna.wsc.CannotRegisterException ex) { // cause could actually be no activity or already registered throw new UnknownTransactionException(); } }
/** * Handle the readOnly decision event. * * Active -> None (send ReadOnly) * Preparing -> None (send ReadOnly) */ private void readOnlyDecision() { final State current ; synchronized(this) { current = state ; if ((current == State.STATE_ACTIVE) || (current == State.STATE_PREPARING)) { state = null ; } } if ((current == State.STATE_ACTIVE) || (current == State.STATE_PREPARING)) { sendReadOnly() ; forget() ; } }