Add LeaderTransitioning message to RaftActor
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / base / messages / UpdateElectionTerm.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9 package org.opendaylight.controller.cluster.raft.base.messages;
10
11 import java.io.Serializable;
12
13 /**
14  * Message class to persist election term information.
15  */
16 public class UpdateElectionTerm implements Serializable {
17     private static final long serialVersionUID = 1L;
18
19     private final long currentTerm;
20     private final String votedFor;
21
22     public UpdateElectionTerm(long currentTerm, String votedFor) {
23         this.currentTerm = currentTerm;
24         this.votedFor = votedFor;
25     }
26
27     public long getCurrentTerm() {
28         return currentTerm;
29     }
30
31     public String getVotedFor() {
32         return votedFor;
33     }
34
35     @Override
36     public String toString() {
37         StringBuilder builder = new StringBuilder();
38         builder.append("UpdateElectionTerm [currentTerm=").append(currentTerm).append(", votedFor=").append(votedFor)
39                 .append("]");
40         return builder.toString();
41     }
42 }