public final Object createSubordinate () throws NoActivityException, InvalidProtocolException, SystemException { try { CoordinatorServiceImple coordManager = (CoordinatorServiceImple) _coordManager; BACoordinator subordinateTransaction = coordManager.createSubordinate(); /* * Now add the registrar for this specific coordinator to the * mapper. */ subordinateTransaction.enlistSynchronization(new CleanupSynchronization(subordinateTransaction.get_uid().stringForm(), _theRegistrar)); _theRegistrar.associate(subordinateTransaction); return subordinateTransaction; } catch (Exception ex) { throw new SystemException(ex.toString()); } }
public synchronized void participantCannotComplete (String participantId) throws InvalidParticipantException, WrongStateException, SystemException { if (participantId == null) throw new SystemException( wscfLogger.i18NLogger.get_model_sagas_arjunacore_BACoordinator_2()); int status = status(); // cannot complete is only legitimate when the TX is in these states switch (status) { case ActionStatus.RUNNING: // if a participant notifies this then we need to mark the transaction as abort only preventCommit(); // !!! deliberate drop through !!! case ActionStatus.ABORT_ONLY: changeParticipantStatus(participantId, DELISTED); break; default: throw new WrongStateException( wscfLogger.i18NLogger.get_model_sagas_arjunacore_BACoordinator_3()); } }
public synchronized void participantCompleted (String participantId) throws InvalidParticipantException, WrongStateException, SystemException { if (participantId == null) throw new SystemException( wscfLogger.i18NLogger.get_model_sagas_arjunacore_BACoordinator_2()); int status = status(); // completed is only legitimate when the TX is in these states switch (status) { case ActionStatus.ABORTED: break; case ActionStatus.RUNNING: case ActionStatus.ABORT_ONLY: changeParticipantStatus(participantId, COMPLETED); break; default: throw new WrongStateException( wscfLogger.i18NLogger.get_model_sagas_arjunacore_BACoordinator_3()); } }
(status == ActionStatus.H_HAZARD)) super.phase2Commit( _reportHeuristics ) ; } else if ((status == ActionStatus.ABORTED) || (status == ActionStatus.H_ROLLBACK) || (status == ActionStatus.ABORT_ONLY)) super.phase2Abort( _reportHeuristics ) ;
SystemException int status = status(); preventCommit(); wscfLogger.i18NLogger.warn_model_sagas_arjunacore_BACoordinator_1(get_uid());
public BACoordinator(Uid recovery) { super(recovery); _theId = new CoordinatorIdImple(get_uid()); }
/** * An activity has begun and is active on the current thread. */ public void begin () throws SystemException { try { BACoordinator coord = new BACoordinator(); int status = coord.start(parentCoordinator()); if (status != ActionStatus.RUNNING) throw new BegunFailedException(wscfLogger.i18NLogger.get_model_sagas_arjunacore_CoordinatorControl_1() + ActionStatus.stringForm(status)); else { _coordinators.put(currentActivity(), coord); } } catch (SystemException ex) { throw ex; } catch (Exception ex) { throw new UnexpectedException(ex.toString()); } }
ActionHierarchy txHier = currentCoordinator.getHierarchy(); final int depth = txHier.depth() ; _identifierValues = new String[depth] ;
/** * this is driven by a coordinator-completion participant registered on behalf of the coordinator * and is required to propagate the cancel to all registered participants. */ public int cancel () { int status = status(); int result; // TODO -- check if there is a window here where status could change to COMMITTING if (status == ActionStatus.COMMITTING) { phase2Abort(true); result = status(); } else { result = super.cancel(); } SubordinateBACoordinator.removeRecoveredCoordinator(this); // run any callback associated with this transaction runCallback(get_uid().stringForm()); return result; }
/** * Enrol the specified synchronization with the coordinator associated with * the current thread. * * @param act The synchronization to add. * * @exception WrongStateException * Thrown if the coordinator is not in a state that allows * participants to be enrolled. * @exception DuplicateSynchronizationException * Thrown if the participant has already been enrolled and * the coordination protocol does not support multiple * entries. * @exception InvalidSynchronizationException * Thrown if the participant is invalid. * @exception SystemException * Thrown if any other error occurs. */ public void enlistSynchronization (Synchronization act) throws WrongStateException, DuplicateSynchronizationException, InvalidSynchronizationException, SystemException { if (act == null) throw new InvalidSynchronizationException(); SynchronizationRecord rec = new SynchronizationRecord(act, new Uid()); if (addSynchronization(rec) != AddOutcome.AR_ADDED) throw new WrongStateException(); }
if (add(rec) != AddOutcome.AR_ADDED) throw new WrongStateException(); else
(status == ActionStatus.H_HAZARD)) super.phase2Commit( _reportHeuristics ) ; } else if ((status == ActionStatus.ABORTED) || (status == ActionStatus.H_ROLLBACK) || (status == ActionStatus.ABORT_ONLY)) super.phase2Abort( _reportHeuristics ) ;
SystemException int status = status(); preventCommit(); wscfLogger.i18NLogger.warn_model_sagas_arjunacore_BACoordinator_1(get_uid());
public synchronized void participantCompleted (String participantId) throws InvalidParticipantException, WrongStateException, SystemException { if (participantId == null) throw new SystemException( wscfLogger.i18NLogger.get_model_sagas_arjunacore_BACoordinator_2()); int status = status(); // completed is only legitimate when the TX is in these states switch (status) { case ActionStatus.ABORTED: break; case ActionStatus.RUNNING: case ActionStatus.ABORT_ONLY: changeParticipantStatus(participantId, COMPLETED); break; default: throw new WrongStateException( wscfLogger.i18NLogger.get_model_sagas_arjunacore_BACoordinator_3()); } }
public BACoordinator() { super(); _theId = new CoordinatorIdImple(get_uid()); }
/** * An activity has begun and is active on the current thread. */ public void begin () throws SystemException { try { BACoordinator coord = new BACoordinator(); int status = coord.start(parentCoordinator()); if (status != ActionStatus.RUNNING) throw new BegunFailedException(wscfLogger.i18NLogger.get_model_sagas_arjunacore_CoordinatorControl_1() + ActionStatus.stringForm(status)); else { _coordinators.put(currentActivity(), coord); } } catch (SystemException ex) { throw ex; } catch (Exception ex) { throw new UnexpectedException(ex.toString()); } }
ActionHierarchy txHier = currentCoordinator.getHierarchy(); final int depth = txHier.depth() ; _identifierValues = new String[depth] ;
/** * this is driven by a coordinator-completion participant registered on behalf of the coordinator * and is required to propagate the cancel to all registered participants. */ public int cancel () { int status = status(); int result; // TODO -- check if there is a window here where status could change to COMMITTING if (status == ActionStatus.COMMITTING) { phase2Abort(true); result = status(); } else { result = super.cancel(); } SubordinateBACoordinator.removeRecoveredCoordinator(this); // run any callback associated with this transaction runCallback(get_uid().stringForm()); return result; }