/** * 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 || !(subordinateCoordinatorRecoveryStarted && participantRecoveryStarted)) { return; } culledOrphanSubordinates = true; SubordinateATCoordinator[] coordinators = SubordinateATCoordinator.listRecoveredCoordinators(); for (SubordinateATCoordinator coordinator : coordinators) { if (coordinator.getSubordinateType().equals(SubordinateATCoordinator.SUBORDINATE_TX_TYPE_AT_AT) && coordinator.isOrphaned()) { RecoveryLogger.i18NLogger.warn_participant_at_XTSATRecoveryModule_5(coordinator.get_uid()); coordinator.rollback(); } } }
/** * 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; }
/** * perform a phase 2 commit for the bridged-to transaction */ public void commit () { coordinator.commit(); }
coordinator.rollback(); } else { boolean isRecoveryScanStarted = recoveryManager.isSubordinateCoordinatorRecoveryStarted(); coordinator = SubordinateATCoordinator.getRecoveredCoordinator(coordinatorId); if (coordinator == null) { if (!isRecoveryScanStarted) { } else if(!coordinator.isActivated()) { int status = coordinator.status(); (status == ActionStatus.ABORT_ONLY)) { coordinator.rollback(); SubordinateATCoordinator.removeActiveProxy(coordinatorId); status = coordinator.status();
coordinator.commit(); } else { XTSATRecoveryManager recoveryManager = null; coordinator = SubordinateATCoordinator.getRecoveredCoordinator(coordinatorId); } else if(!coordinator.isActivated()) { int status = coordinator.status(); coordinator.commit(); SubordinateATCoordinator.removeActiveProxy(coordinatorId); status = coordinator.status();
/** * normal constructor used when the subordinate coordinator is registered as a durable participant * with its parent coordinator. * * @param coordinator */ public SubordinateDurable2PCStub(SubordinateATCoordinator coordinator) { this.coordinator = coordinator; this.coordinatorId = coordinator.get_uid().stringForm(); this.recovered = false; }
SubordinateATCoordinator.removeRecoveredCoordinator(this); runCallback(get_uid().stringForm());
String vtppid = subTx.getVolatile2PhaseId(); String dtppid = subTx.getDurable2PhaseId(); Volatile2PCParticipant vtpp = new SubordinateVolatile2PCStub(subTx); Durable2PCParticipant dtpp = new SubordinateDurable2PCStub(subTx); coordinationContext.setCoordinationType(coordinationTypeURI); CoordinationContextType.Identifier identifier = new CoordinationContextType.Identifier(); String txId = subTx.get_uid().stringForm(); identifier.setValue("urn:" + txId); coordinationContext.setIdentifier(identifier) ;
SubordinateATCoordinator[] coordinators = SubordinateATCoordinator.listRecoveredCoordinators(); int count = 0; if (coordinators[i].getSubordinateType().equals(subordinateType)) { count++; if (coordinator.getSubordinateType().equals(subordinateType)) { BridgeWrapper bridgeWrapper = new BridgeWrapper(); bridgeWrapper.context = null; bridgeWrapper.coordinator = coordinator; bridgeWrapper.id = coordinator.get_uid().stringForm(); bridgeWrapper.subordinateType = coordinator.getSubordinateType(); result[count++] = bridgeWrapper;
/** * recreate a wrapper for a bridged-to WS-AT 1.1 transaction recovered from the log * @param identifier the identifier of a previously created bridged-to transaction * @return a wrapper for the bridged-to transaction or null if it may still be awaiting recovery * @throws UnknownTransactionException if recovery has been performed and no transaction with the * given identifier has been found in the log */ public static BridgeWrapper recover(String identifier) throws UnknownTransactionException { SubordinateATCoordinator coordinator = SubordinateATCoordinator.getRecoveredCoordinator(identifier); if (coordinator != null) { BridgeWrapper bridgeWrapper = new BridgeWrapper(); bridgeWrapper.context = null; bridgeWrapper.coordinator =coordinator; bridgeWrapper.id = identifier; bridgeWrapper.subordinateType = coordinator.getSubordinateType(); return bridgeWrapper; } else { XTSATRecoveryManager recoveryManager = XTSATRecoveryManager.getRecoveryManager(); if (recoveryManager != null && recoveryManager.isCoordinatorRecoveryStarted()) { throw new UnknownTransactionException(); } else { return null; } } }
if (SubordinateATCoordinator.getRecoveredCoordinator(recoverUid.stringForm()) != null) { return;
/** * initiate synchronization beforeCompletion processing for the bridged-to transaction * * @return true if the beforeCompletion succeeds otherwise false. */ public boolean prepareVolatile() { return coordinator.prepareVolatile(); }
/** * prepare the bridged-to transaction * @return the result of preparing the transaction */ public int prepare () { return coordinator.prepare(); }
/** * this is called as part of the after completion processing and should ensure that the interposed * coordinator performs its afterCompletion processing * @throws WrongStateException * @throws SystemException */ public void commit() throws WrongStateException, SystemException { coordinator.commitVolatile(); }
/** * initiate synchronization afterCompletion processing for the bridged-to transaction following a * rollback */ public void rollbackVolatile() { coordinator.rollbackVolatile(); }
/** * rollback the bridged-to transaction */ public void rollback () { coordinator.rollback(); }
coordinator.rollback(); } else { boolean isRecoveryScanStarted = recoveryManager.isSubordinateCoordinatorRecoveryStarted(); coordinator = SubordinateATCoordinator.getRecoveredCoordinator(coordinatorId); if (coordinator == null) { if (!isRecoveryScanStarted) { } else if(!coordinator.isActivated()) { int status = coordinator.status(); (status == ActionStatus.ABORT_ONLY)) { coordinator.rollback(); SubordinateATCoordinator.removeActiveProxy(coordinatorId); status = coordinator.status();
coordinator.commit(); } else { XTSATRecoveryManager recoveryManager = null; coordinator = SubordinateATCoordinator.getRecoveredCoordinator(coordinatorId); } else if(!coordinator.isActivated()) { int status = coordinator.status(); coordinator.commit(); SubordinateATCoordinator.removeActiveProxy(coordinatorId); status = coordinator.status();
/** * return a uid for the durable participant registered on behalf of this corodinator */ public String getDurable2PhaseId() { return PARTICIPANT_PREFIX + get_uid().stringForm() + "_D"; }
SubordinateATCoordinator.removeRecoveredCoordinator(this); runCallback(get_uid().stringForm());