2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.cluster.raft.client.messages;
11 import com.google.common.annotations.VisibleForTesting;
12 import java.io.Serializable;
13 import java.util.Optional;
14 import javax.annotation.Nullable;
17 * Reply to {@link FindLeader} message, containing the address of the leader actor, as known to the raft actor which
18 * sent the message. If the responding actor does not have knowledge of the leader, {@link #getLeaderActor()} will
19 * return {@link Optional#empty()}.
21 * This message is intended for testing purposes only.
24 public final class FindLeaderReply implements Serializable {
25 private static final long serialVersionUID = 1L;
26 private final String leaderActor;
28 public FindLeaderReply(@Nullable final String leaderActor) {
29 this.leaderActor = leaderActor;
32 public Optional<String> getLeaderActor() {
33 return Optional.ofNullable(leaderActor);