refactor: jraft protocol
This commit is contained in:
parent
587a0937c9
commit
5f39cc8d75
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user