X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2Fclient%2Fmessages%2FFindLeaderReply.java;h=b4b34437e844e7d160fbc7e4e7c77388172d334c;hb=b4bf55727093657662d8c16a50fa85f87978a586;hp=64c73508960144ab3f0095ba3af34c897217c336;hpb=96e61c15761ca887620f53d6f20ac574d16287f8;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 64c7350896..b4b34437e8 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 @@ -5,19 +5,31 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.controller.cluster.raft.client.messages; +import com.google.common.annotations.VisibleForTesting; import java.io.Serializable; +import java.util.Optional; +import org.eclipse.jdt.annotation.Nullable; -public class FindLeaderReply implements Serializable { +/** + * 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(final @Nullable String leaderActor) { this.leaderActor = leaderActor; } - public String getLeaderActor() { - return leaderActor; + public Optional getLeaderActor() { + return Optional.ofNullable(leaderActor); } }