public void rollback() throws WrongStateException, SystemException {
if (!isRecovered()) {
coordinator.rollback();
} else {
// first check whether crashed coordinators have been recovered
XTSATRecoveryManager recoveryManager = XTSATRecoveryManager.getRecoveryManager();
boolean isRecoveryScanStarted = recoveryManager.isSubordinateCoordinatorRecoveryStarted();
// now look for a subordinate coordinator with the right id
coordinator = SubordinateCoordinator.getRecoveredCoordinator(coordinatorId);
if (coordinator == null) {
if (!isRecoveryScanStarted) {
// the subtransaction may still be waiting to be resolved