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 / ApplyJournalEntries.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 java.io.Serializable;
11
12 /**
13  * This is an internal message that is stored in the akka's persistent journal. During recovery, this
14  * message is used to apply recovered journal entries to the state whose indexes range from the context's
15  * current lastApplied index to "toIndex" contained in the message. This message is sent internally from a
16  * behavior to the RaftActor to persist.
17  *
18  * @author Thomas Pantelis
19  *
20  * @deprecated Use {@link org.opendaylight.controller.cluster.raft.persisted.ApplyJournalEntries} instead.
21  */
22 @Deprecated
23 public class ApplyJournalEntries implements Serializable {
24     private static final long serialVersionUID = 1L;
25
26     private final long toIndex;
27
28     public ApplyJournalEntries(long toIndex) {
29         this.toIndex = toIndex;
30     }
31
32     public long getToIndex() {
33         return toIndex;
34     }
35
36     private Object readResolve() {
37         return org.opendaylight.controller.cluster.raft.persisted.ApplyJournalEntries.createMigrated(toIndex);
38     }
39
40     @Override
41     public String toString() {
42         StringBuilder builder = new StringBuilder();
43         builder.append("ApplyJournalEntries [toIndex=").append(toIndex).append("]");
44         return builder.toString();
45     }
46 }