修改回调机制
This commit is contained in:
parent
8f85fc7a1e
commit
1507e758cd
|
|
@ -204,6 +204,15 @@ public class TransactionExecutor {
|
||||||
}
|
}
|
||||||
}, commandExecutor).thenCompose(remoteCallSuccess -> {
|
}, commandExecutor).thenCompose(remoteCallSuccess -> {
|
||||||
if (!remoteCallSuccess) {
|
if (!remoteCallSuccess) {
|
||||||
|
// 命令发送失败,取消已注册的回调(避免资源泄漏)
|
||||||
|
if (finalMethodFuture != null) {
|
||||||
|
log.warn("命令发送失败,取消方法回调");
|
||||||
|
finalMethodFuture.cancel(true);
|
||||||
|
}
|
||||||
|
if (finalStateFuture != null) {
|
||||||
|
log.warn("命令发送失败,取消状态回调");
|
||||||
|
finalStateFuture.cancel(true);
|
||||||
|
}
|
||||||
InstructionResult result = InstructionResult.failure("远程调用失败");
|
InstructionResult result = InstructionResult.failure("远程调用失败");
|
||||||
instruction.onComplete(context, result);
|
instruction.onComplete(context, result);
|
||||||
return CompletableFuture.completedFuture(result);
|
return CompletableFuture.completedFuture(result);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue