Take snapshot after recovery on migrated messages
[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  * @deprecated Use {@link org.opendaylight.controller.cluster.raft.persisted.UpdateElectionTerm} instead.
17  */
18 @Deprecated
19 public class UpdateElectionTerm implements Serializable {
20     private static final long serialVersionUID = 1L;
21
22     private final long currentTerm;
23     private final String votedFor;
24
25     public UpdateElectionTerm(long currentTerm, String votedFor) {
26         this.currentTerm = currentTerm;
27         this.votedFor = votedFor;
28     }
29
30     public long getCurrentTerm() {
31         return currentTerm;
32     }
33
34     public String getVotedFor() {
35         return votedFor;
36     }
37
38     private Object readResolve() {
39         return org.opendaylight.controller.cluster.raft.persisted.UpdateElectionTerm.createMigrated(
40                 currentTerm, votedFor);
41     }
42
43     @Override
44     public String toString() {
45         StringBuilder builder = new StringBuilder();
46         builder.append("UpdateElectionTerm [currentTerm=").append(currentTerm).append(", votedFor=").append(votedFor)
47                 .append("]");
48         return builder.toString();
49     }
50 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.