refactor: jraft protocol

This commit is contained in:
chuntaojun 2020-05-18 11:00:11 +08:00
parent 587a0937c9
commit 5f39cc8d75
3 changed files with 5 additions and 5 deletions

View File

@ -344,7 +344,6 @@ public class JRaftServer {
});
}
public CompletableFuture<Response> commit(final String group, final Message data, final CompletableFuture<Response> future) {
LoggerUtils
.printIfDebugEnabled(Loggers.RAFT, "data requested this time : {}", data);

View File

@ -16,7 +16,6 @@
package com.alibaba.nacos.core.distributed.raft;
import com.alibaba.nacos.consistency.entity.Log;
import com.alipay.sofa.jraft.Closure;
import com.alipay.sofa.jraft.Status;
import com.google.protobuf.Message;

View File

@ -16,7 +16,9 @@
package com.alibaba.nacos.core.distributed.raft.utils;
import com.alibaba.nacos.common.utils.LoggerUtils;
import com.alibaba.nacos.consistency.exception.ConsistencyException;
import com.alibaba.nacos.core.utils.Loggers;
import com.alipay.sofa.jraft.Status;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
@ -49,12 +51,12 @@ public class FailoverClosureImpl<T> implements FailoverClosure<T> {
@Override
public void run(Status status) {
if (status.isOk()) {
future.complete(data);
return;
boolean success = future.complete(data);
LoggerUtils.printIfDebugEnabled(Loggers.RAFT, "future.complete execute {}", success);
}
final Throwable throwable = this.throwable;
if (Objects.nonNull(throwable)) {
future.completeExceptionally(new ConsistencyException(throwable));
future.completeExceptionally(new ConsistencyException(throwable.toString()));
} else {
future.completeExceptionally(new ConsistencyException("operation failure"));
}