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) {
|
public CompletableFuture<Response> commit(final String group, final Message data, final CompletableFuture<Response> future) {
|
||||||
LoggerUtils
|
LoggerUtils
|
||||||
.printIfDebugEnabled(Loggers.RAFT, "data requested this time : {}", data);
|
.printIfDebugEnabled(Loggers.RAFT, "data requested this time : {}", data);
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.alibaba.nacos.core.distributed.raft;
|
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.Closure;
|
||||||
import com.alipay.sofa.jraft.Status;
|
import com.alipay.sofa.jraft.Status;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
|
@ -16,7 +16,9 @@
|
|||||||
|
|
||||||
package com.alibaba.nacos.core.distributed.raft.utils;
|
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.consistency.exception.ConsistencyException;
|
||||||
|
import com.alibaba.nacos.core.utils.Loggers;
|
||||||
import com.alipay.sofa.jraft.Status;
|
import com.alipay.sofa.jraft.Status;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@ -49,12 +51,12 @@ public class FailoverClosureImpl<T> implements FailoverClosure<T> {
|
|||||||
@Override
|
@Override
|
||||||
public void run(Status status) {
|
public void run(Status status) {
|
||||||
if (status.isOk()) {
|
if (status.isOk()) {
|
||||||
future.complete(data);
|
boolean success = future.complete(data);
|
||||||
return;
|
LoggerUtils.printIfDebugEnabled(Loggers.RAFT, "future.complete execute {}", success);
|
||||||
}
|
}
|
||||||
final Throwable throwable = this.throwable;
|
final Throwable throwable = this.throwable;
|
||||||
if (Objects.nonNull(throwable)) {
|
if (Objects.nonNull(throwable)) {
|
||||||
future.completeExceptionally(new ConsistencyException(throwable));
|
future.completeExceptionally(new ConsistencyException(throwable.toString()));
|
||||||
} else {
|
} else {
|
||||||
future.completeExceptionally(new ConsistencyException("operation failure"));
|
future.completeExceptionally(new ConsistencyException("operation failure"));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user