Bug 7391: Fix out-of-order LeaderStateChange events
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / base / messages / LeaderTransitioning.java
1 /*
2  * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.cluster.raft.base.messages;
9
10 import com.google.common.base.Preconditions;
11 import java.io.Serializable;
12 import javax.annotation.Nonnull;
13
14 /**
15  * Message sent from a leader to its followers to indicate leadership transfer is starting.
16  *
17  * @author Thomas Pantelis
18  */
19 public final class LeaderTransitioning implements Serializable {
20     private static final long serialVersionUID = 1L;
21
22     private final String leaderId;
23
24     public LeaderTransitioning(@Nonnull final String leaderId) {
25         this.leaderId = Preconditions.checkNotNull(leaderId);
26     }
27
28     @Nonnull
29     public String getLeaderId() {
30         return leaderId;
31     }
32
33     @Override
34     public String toString() {
35         return "LeaderTransitioning [leaderId=" + leaderId + "]";
36     }
37 }