X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2FRaftActorServerConfigurationSupport.java;h=6c8bf14136d21a218181ffe02aa1cedfa3429de1;hp=9e40c98e6b079692ef320f1270da9d185a81168c;hb=72d2a44d009ca37696018d7aba3615ddd256560a;hpb=5c3e3812eca4e7a06c69c376037578fae49828a2 diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorServerConfigurationSupport.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorServerConfigurationSupport.java index 9e40c98e6b..6c8bf14136 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorServerConfigurationSupport.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorServerConfigurationSupport.java @@ -18,6 +18,7 @@ import java.util.List; import java.util.Queue; import java.util.UUID; import java.util.concurrent.TimeUnit; +import javax.annotation.Nullable; import org.opendaylight.controller.cluster.raft.ServerConfigurationPayload.ServerInfo; import org.opendaylight.controller.cluster.raft.base.messages.ApplyState; import org.opendaylight.controller.cluster.raft.base.messages.SnapshotComplete; @@ -190,22 +191,22 @@ class RaftActorServerConfigurationSupport { newConfig.add(new ServerInfo(raftContext.getId(), true)); - LOG.debug("{}: New server configuration : {}", raftContext.getId(), newConfig); + LOG.debug("{}: Persisting new server configuration : {}", raftContext.getId(), newConfig); ServerConfigurationPayload payload = new ServerConfigurationPayload(newConfig); raftActor.persistData(operationContext.getClientRequestor(), operationContext.getContextId(), payload); currentOperationState = new Persisting(operationContext); + + sendReply(raftActor, operationContext, ServerChangeStatus.OK); } protected void operationComplete(RaftActor raftActor, ServerOperationContext operationContext, - ServerChangeStatus status) { - - LOG.debug("{}: Returning {} for operation {}", raftContext.getId(), status, operationContext.getOperation()); - - operationContext.getClientRequestor().tell(operationContext.newReply(status, raftActor.getLeaderId()), - raftActor.self()); + @Nullable ServerChangeStatus replyStatus) { + if(replyStatus != null) { + sendReply(raftActor, operationContext, replyStatus); + } currentOperationState = IDLE; @@ -215,6 +216,14 @@ class RaftActorServerConfigurationSupport { } } + private void sendReply(RaftActor raftActor, ServerOperationContext operationContext, + ServerChangeStatus status) { + LOG.debug("{}: Returning {} for operation {}", raftContext.getId(), status, operationContext.getOperation()); + + operationContext.getClientRequestor().tell(operationContext.newReply(status, raftActor.getLeaderId()), + raftActor.self()); + } + @Override public String toString() { return getClass().getSimpleName(); @@ -254,7 +263,7 @@ class RaftActorServerConfigurationSupport { LOG.info("{}: {} has been successfully replicated to a majority of followers", applyState.getReplicatedLogEntry().getData()); - operationComplete(raftActor, operationContext, ServerChangeStatus.OK); + operationComplete(raftActor, operationContext, null); } } }