/** * look for recovered subordinate transactions which do not have an associated proxy participant * rolling back any that are found. this only needs doing once after the first participant and * subordinate transaction recovery passes have both completed */ private void cullOrphanedSubordinates() { if (culledOrphanSubordinates || !(subordinateCoordinateRecoveryStarted && participantRecoveryStarted)) { return; } culledOrphanSubordinates = true; SubordinateBACoordinator[] coordinators = SubordinateBACoordinator.listRecoveredCoordinators(); for (SubordinateBACoordinator coordinator : coordinators) { if (coordinator.isOrphaned()) { RecoveryLogger.i18NLogger.warn_participant_ba_XTSBARecoveryModule_5(coordinator.get_uid()); coordinator.cancel(); } } }
/** * test whether a transaction has been restored without its proxy participant. this indicates that * we crashed between preparing the suborindate TX and logging the proxy participant. * @return */ public boolean isOrphaned() { String id = get_uid().stringForm(); if (isActiveProxy(id)) { return false; } // the proxy may have been removed because this tx has been resolved while we were checking if (getRecoveredCoordinator(id) == null) { return false; } // ok we have a tx but no proxy so this is really an orphan return true; }
/** * run parent activate and also make this coordinator visible if there might be a durable participant waiting * for it to commit. * @return */ public boolean activate() { boolean result = super.activate(); // if we cannot activate we want the participant which was registered on behalf of this // coordinator to produce a heuristic result for the transaction. it will do this if it // finds no entry for the coordinate in the subordinate coordinators list. in this case // the subordinate transaction record needs to left as is awaiting manual intervention. if (result) { // record that the activation worked setActivated(); int status = status(); if (status == ActionStatus.PREPARED || status == ActionStatus.COMMITTING) { // we need to install this coordinator in a global table so that the participant which // was driving it will know that it has been recovered but not yet committed SubordinateBACoordinator.addRecoveredCoordinator(this); } } return result; }
/** * 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; }
public void compensate() throws FaultedException, WrongStateException, SystemException { if (!recovered) { int result = coordinator.cancel(); coordinator = SubordinateBACoordinator.getRecoveredCoordinator(coordinatorId); } else if(!coordinator.isActivated()) { int status = coordinator.status(); coordinator.cancel(); SubordinateBACoordinator.removeActiveProxy(coordinatorId); status = coordinator.status();
int result; try { result = coordinator.close(); } catch (com.arjuna.mw.wsas.exceptions.SystemException se) { throw new SystemException(se.getMessage()); coordinator = SubordinateBACoordinator.getRecoveredCoordinator(coordinatorId); } else if(!coordinator.isActivated()) { int status = coordinator.status(); coordinator.close(); SubordinateBACoordinator.removeActiveProxy(coordinatorId); } catch (com.arjuna.mw.wsas.exceptions.SystemException e) { status = coordinator.status();
/** * this is driven by a coordinator-completion participant registered on behalf of the coordinator * and is required to propagate the close to all registered participants. */ public int close () throws SystemException { int status = status(); int result; if (status == ActionStatus.COMMITTING) { // TODO -- need to do completion processing here? // we already completed and ran phase 1 so do a phase 2 commit phase2Commit(true); result = status(); } else { // we have not yet completed so we can rely upon the parent implementation to do // everything we need result = super.close(); } // if we have completed then remove the coordinator from the recovered coordinators table if (status() != ActionStatus.COMMITTING) { SubordinateBACoordinator.removeRecoveredCoordinator(this); } // run any callback associated with this transaction runCallback(get_uid().stringForm()); return result; }
public SubordinateCoordinatorCompletionParticipantStub(SubordinateBACoordinator coordinator) { this.coordinator = coordinator; this.coordinatorId = coordinator.get_uid().stringForm(); this.recovered = false; this.manager = null; }
String ccpid = subTx.getCoordinatorCompletionParticipantid(); SubordinateCoordinatorCompletionParticipantStub ccp = new SubordinateCoordinatorCompletionParticipantStub(subTx); String messageId = MessageId.getMessageId() ; coordinationContext.setCoordinationType(coordinationTypeURI); CoordinationContextType.Identifier identifier = new CoordinationContextType.Identifier(); String txId = subTx.get_uid().stringForm(); identifier.setValue("urn:" + txId); coordinationContext.setIdentifier(identifier) ;
public void complete() throws WrongStateException, SystemException { if (!recovered) { // the coordinator will send complete to all participants and then // also run phase one commit. the former may throw an exception. // if the latter succeeds the tx state will be COMMITTING whereas // if it fails it will be ABORTED. try { coordinator.complete(); } catch (com.arjuna.mw.wsas.exceptions.WrongStateException wse) { throw new WrongStateException(wse.getMessage()); } catch (com.arjuna.mw.wsas.exceptions.SystemException se) { throw new SystemException(se.getMessage()); } // if status is COMMITTING then we return allowing the participant to be logged // if status is ABORTED then the participant must fail avoiding any logging if (coordinator.status() == ActionStatus.ABORTED) { manager.fail(BusinessActivityConstants.WSBA_ELEMENT_FAIL_QNAME); } else { // null out the manager so we don't attempt to save it to the log manager = null; } } else { // we should never get asked to complete a recovered activity throw new WrongStateException(); } }
if (SubordinateBACoordinator.getRecoveredCoordinator(recoverUid.stringForm()) != null) { return;
public void exit () throws WrongStateException, UnknownTransactionException, SystemException { try { _theTx.delistParticipant(_participantId); } catch (com.arjuna.mw.wscf.exceptions.InvalidParticipantException ex) { throw new SystemException("UnknownParticipantException"); } catch (com.arjuna.mw.wsas.exceptions.WrongStateException ex) { throw new WrongStateException(); } catch (com.arjuna.mw.wsas.exceptions.SystemException ex) { throw new SystemException(ex.toString()); } }
/** * Restore the state of the particpant from the specified input object stream. * @param ios The Input object stream. * @return true if restored, false otherwise. */ public boolean restoreState(InputObjectState ios) { // restore the subordinate coordinator id so we can check to ensure it has been committed try { coordinatorId = ios.unpackString(); SubordinateBACoordinator.addActiveProxy(coordinatorId); return true; } catch (IOException e) { return false; } }
SubordinateBACoordinator.addCallback(subordinateId, callback);
public void compensate() throws FaultedException, WrongStateException, SystemException { if (!recovered) { int result = coordinator.cancel(); coordinator = SubordinateBACoordinator.getRecoveredCoordinator(coordinatorId); } else if(!coordinator.isActivated()) { int status = coordinator.status(); coordinator.cancel(); SubordinateBACoordinator.removeActiveProxy(coordinatorId); status = coordinator.status();
int result; try { result = coordinator.close(); } catch (com.arjuna.mw.wsas.exceptions.SystemException se) { throw new SystemException(se.getMessage()); coordinator = SubordinateBACoordinator.getRecoveredCoordinator(coordinatorId); } else if(!coordinator.isActivated()) { int status = coordinator.status(); coordinator.close(); SubordinateBACoordinator.removeActiveProxy(coordinatorId); } catch (com.arjuna.mw.wsas.exceptions.SystemException e) { status = coordinator.status();
/** * 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; }
/** * this is driven by a coordinator-completion participant registered on behalf of the coordinator * and is required to propagate the close to all registered participants. */ public int close () throws SystemException { int status = status(); int result; if (status == ActionStatus.COMMITTING) { // TODO -- need to do completion processing here? // we already completed and ran phase 1 so do a phase 2 commit phase2Commit(true); result = status(); } else { // we have not yet completed so we can rely upon the parent implementation to do // everything we need result = super.close(); } // if we have completed then remove the coordinator from the recovered coordinators table if (status() != ActionStatus.COMMITTING) { SubordinateBACoordinator.removeRecoveredCoordinator(this); } // run any callback associated with this transaction runCallback(get_uid().stringForm()); return result; }
public SubordinateCoordinatorCompletionParticipantStub(SubordinateBACoordinator coordinator) { this.coordinator = coordinator; this.coordinatorId = coordinator.get_uid().stringForm(); this.recovered = false; this.manager = null; }
String ccpid = subTx.getCoordinatorCompletionParticipantid(); SubordinateCoordinatorCompletionParticipantStub ccp = new SubordinateCoordinatorCompletionParticipantStub(subTx); String messageId = MessageId.getMessageId() ; coordinationContext.setCoordinationType(coordinationTypeURI); CoordinationContextType.Identifier identifier = new CoordinationContextType.Identifier(); String txId = subTx.get_uid().stringForm(); identifier.setValue("urn:" + txId); coordinationContext.setIdentifier(identifier) ;