public void logHeuristicBranch(BranchXid bxid, LogRecord lr) throws Exception {
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "jdbcTxLog: log branch heuristic decision "+lr);
}
final GlobalXid gxid = lr.getGlobalXid();
final BranchXid branchXid = bxid;
final LogRecord newlr = lr;
super.checkClosedAndSetInProgress();
try {
UpdateOpaqueDataCallback callback = new UpdateOpaqueDataCallback() {
public Object update(Object currlr) throws Exception {
ObjectInputStream ois = new ObjectInputStream(
new ByteArrayInputStream((byte[])currlr));
LogRecord oldlr = (LogRecord)ois.readObject();
if (!oldlr.getGlobalXid().equals(gxid)) {
throw new IllegalArgumentException(
"Unexpected global xid "+oldlr.getGlobalXid()+" from store, expected:"+gxid);
}
ois.close();
if (oldlr == null) {
throw new IllegalArgumentException(
"Unexpected null current log record for "+gxid);
}
if (oldlr.getBranchDecision(branchXid) ==
newlr.getBranchDecision(branchXid)) {
return currlr;
}
oldlr.setBranchDecision(branchXid, newlr.getBranchDecision(branchXid));
return oldlr;
}
};
_store.updateTMLogRecord(gxid.toString(), lr.toBytes(), _jmsbridge,
callback, true, true, _logger);
} finally {
super.setInProgress(false);
}
}