rollback();
throw new RollbackException(toString());
}
if (!onePhase) {
try {
LogRecord lr = new LogRecord(_gxid, _participants.values(), GlobalXidDecision.COMMIT);
_txlog.logGlobalDecision(lr);
} catch (Throwable t) {
setRollbackOnly();
_logger.log(Level.SEVERE, "Unable to log commit decision "+this, t);
rollback();
RollbackException ex = new RollbackException(toString()+": "+t.getMessage());
ex.initCause(t);
throw ex;
}
_status = Status.STATUS_PREPARED;
}
_status = Status.STATUS_COMMITTING;
Exception ex = null;
XAParticipant party = null;
boolean committedOne = false;
for (Map.Entry<XAResource, XAParticipant> pair: _participants.entrySet()) {
party= pair.getValue();
try {
party.commit(onePhase);
committedOne = true;
} catch (IllegalStateException e) {
if (!committedOne) throw e;
ex = e;
continue;
} catch (RollbackException e) {
if (!onePhase) {
_logger.log(Level.SEVERE,
"Unexpected RollbackException on 2-phase commit from "+party, e);
ex = new HeuristicMixedException(e.getMessage());
ex.initCause(e);
continue;
} else {
throw e;
}
} catch (HeuristicCommitException e) {
try {
LogRecord lr = new LogRecord(_gxid, _participants.values(), GlobalXidDecision.COMMIT);
BranchXid bxid = party.getBranchXid();
lr.setBranchHeurCommit(bxid);
_txlog.logHeuristicBranch(bxid, lr);
} catch (Throwable t) {
_logger.log(Level.WARNING, "Unable to log heuristic commit from "+party, t);
}
continue;
} catch (HeuristicMixedException e) {
ex = e;
try {
LogRecord lr = new LogRecord(_gxid, _participants.values(), GlobalXidDecision.COMMIT);
BranchXid bxid = party.getBranchXid();
lr.setBranchHeurMixed(bxid);
_txlog.logHeuristicBranch(bxid, lr);
} catch (Throwable t) {
_logger.log(Level.WARNING, "Unable to log heuristic mixed from "+party, t);
}
continue;
} catch (HeuristicRollbackException e) {
ex = e;
try {
LogRecord lr = new LogRecord(_gxid, _participants.values(), GlobalXidDecision.COMMIT);
BranchXid bxid = party.getBranchXid();
lr.setBranchHeurRollback(bxid);
_txlog.logHeuristicBranch(bxid, lr);
} catch (Throwable t) {
_logger.log(Level.WARNING, "Unable to log heuristic rollback from "+party, t);
}
continue;