X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2Fclient%2Fmessages%2FFindLeaderReply.java;h=549fe038ed5467ca77d963816d4325bbcee0ad3d;hb=d3790efbca191389411dbb71f1940027f95c2c23;hp=b36ef112b364371d01d9e7f411fdf27761938606;hpb=17d82f582a6bc13c78be3b19954ff8c021180e93;p=controller.git diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/FindLeaderReply.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/FindLeaderReply.java index b36ef112b3..549fe038ed 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/FindLeaderReply.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/FindLeaderReply.java @@ -8,14 +8,28 @@ package org.opendaylight.controller.cluster.raft.client.messages; -public class FindLeaderReply { +import com.google.common.annotations.VisibleForTesting; +import java.io.Serializable; +import java.util.Optional; +import javax.annotation.Nullable; + +/** + * Reply to {@link FindLeader} message, containing the address of the leader actor, as known to the raft actor which + * sent the message. If the responding actor does not have knowledge of the leader, {@link #getLeaderActor()} will + * return {@link Optional#empty()}. + * + * This message is intended for testing purposes only. + */ +@VisibleForTesting +public final class FindLeaderReply implements Serializable { + private static final long serialVersionUID = 1L; private final String leaderActor; - public FindLeaderReply(String leaderActor) { + public FindLeaderReply(@Nullable final String leaderActor) { this.leaderActor = leaderActor; } - public String getLeaderActor() { - return leaderActor; + public Optional getLeaderActor() { + return Optional.ofNullable(leaderActor); } }