use of org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager in project narayana by jbosstm.
the class SubordinateDurable2PCStub method commit.
/**
* this will be called when the parent coordinator commits its durable participants and should ensure
* that the interposed cooordinator does the same
* @throws com.arjuna.wst.WrongStateException
* @throws com.arjuna.wst.SystemException
*/
public void commit() throws WrongStateException, SystemException {
if (!isRecovered()) {
coordinator.commit();
} else {
XTSATRecoveryManager recoveryManager = null;
boolean isRecoveryScanStarted = false;
if (coordinator == null) {
// try fetching coordinator from the recovery manager
recoveryManager = XTSATRecoveryManager.getRecoveryManager();
// check whether recovery has started before we check for the presence
// of the subordinate coordinator
isRecoveryScanStarted = recoveryManager.isSubordinateCoordinatorRecoveryStarted();
coordinator = SubordinateATCoordinator.getRecoveredCoordinator(coordinatorId);
}
if (coordinator == null) {
// hmm, still null -- see if we have finished recovery scanning
if (!isRecoveryScanStarted) {
// throw an exception causing the commit to be retried later
throw new SystemException();
}
// ok we have no transaction to commit so assume we already committed it and
// return without error
} else if (!coordinator.isActivated()) {
// throw an exception causing the commit to be retried later
throw new SystemException();
} else {
int status = coordinator.status();
if (status == ActionStatus.PREPARED || status == ActionStatus.COMMITTING) {
// ok, the commit process was not previously initiated so start it now
coordinator.commit();
SubordinateATCoordinator.removeActiveProxy(coordinatorId);
status = coordinator.status();
}
if (status == ActionStatus.COMMITTING) {
// throw an exception causing the commit to be retried later
throw new SystemException();
}
}
}
}
use of org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager in project narayana by jbosstm.
the class BridgeWrapper method recover.
/**
* 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;
}
}
}
Aggregations