-
-
Notifications
You must be signed in to change notification settings - Fork 909
Open
Description
协调者如果没有执行本地数据库操作会抛异常。
回调该方法:org.bytesoft.bytetcc.CompensableTransactionImpl#onCommitSuccess,会抛出异常。
代码如下
private void onCompletionPhaseCommitSuccess(Xid actualXid) {
// this.archive.getCompensableXid() 返回空,将导致异常
Xid expectXid = this.archive == null ? null : this.archive.getCompensableXid();
byte[] expectKey = expectXid == null ? null : expectXid.getGlobalTransactionId();
byte[] actualKey = actualXid.getGlobalTransactionId();
if (Arrays.equals(expectKey, actualKey) == false) {
// this.onInvocationPhaseParticipantCommitSuccess(actualXid);
throw new IllegalStateException("Illegal state: maybe the try phase operation has timed out!");
} // end-if (CommonUtils.equals(expectXid, actualXid) == false)
if (this.positive == null) {
this.beanFactory.getCompensableLogger().updateCompensable(this.archive);
return;
}
if (this.positive) {
logger.info("{}| confirm: identifier= {}, resourceKey= {}, resourceXid= {}.",
ByteUtils.byteArrayToString(transactionContext.getXid().getGlobalTransactionId()),
ByteUtils.byteArrayToString(this.archive.getIdentifier().getGlobalTransactionId()),
this.archive.getCompensableResourceKey(), this.archive.getCompensableXid());
this.archive.setConfirmed(true);
} else {
logger.info("{}| cancel: identifier= {}, resourceKey= {}, resourceXid= {}.",
ByteUtils.byteArrayToString(transactionContext.getXid().getGlobalTransactionId()),
ByteUtils.byteArrayToString(this.archive.getIdentifier().getGlobalTransactionId()),
this.archive.getCompensableResourceKey(), this.archive.getCompensableXid());
this.archive.setCancelled(true);
}
this.beanFactory.getCompensableLogger().updateCompensable(this.archive);
}
Metadata
Metadata
Assignees
Labels
No labels