2 * Copyright (c) 2016 Brocade Communications 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
8 package org.opendaylight.controller.cluster.raft.messages;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.collect.ImmutableSet;
13 import java.io.Serializable;
14 import java.util.Collection;
15 import java.util.HashMap;
17 import org.eclipse.jdt.annotation.NonNull;
20 * Message sent to change the raft voting status for servers.
22 * @author Thomas Pantelis
24 public class ChangeServersVotingStatus implements Serializable {
25 private static final long serialVersionUID = 1L;
27 private final Map<String, Boolean> serverVotingStatusMap;
28 private final Collection<String> serversVisited;
30 public ChangeServersVotingStatus(@NonNull Map<String, Boolean> serverVotingStatusMap) {
31 this(serverVotingStatusMap, ImmutableSet.of());
34 public ChangeServersVotingStatus(@NonNull Map<String, Boolean> serverVotingStatusMap,
35 @NonNull Collection<String> serversVisited) {
36 this.serverVotingStatusMap = new HashMap<>(requireNonNull(serverVotingStatusMap));
37 this.serversVisited = ImmutableSet.copyOf(requireNonNull(serversVisited));
40 public @NonNull Map<String, Boolean> getServerVotingStatusMap() {
41 return serverVotingStatusMap;
44 public @NonNull Collection<String> getServersVisited() {
45 return serversVisited;
49 public String toString() {
50 return "ChangeServersVotingStatus [serverVotingStatusMap=" + serverVotingStatusMap
51 + (serversVisited != null ? ", serversVisited=" + serversVisited : "") + "]";