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.persisted;
10 import java.io.Externalizable;
11 import java.io.IOException;
12 import java.io.ObjectInput;
13 import java.io.ObjectOutput;
14 import java.io.Serializable;
17 * Internal message that is stored in the akka's persistent journal to delete journal entries.
19 * @author Thomas Pantelis
21 public class DeleteEntries implements Serializable {
22 private static final class Proxy implements Externalizable {
23 private static final long serialVersionUID = 1L;
25 private DeleteEntries deleteEntries;
27 // checkstyle flags the public modifier as redundant which really doesn't make sense since it clearly isn't
28 // redundant. It is explicitly needed for Java serialization to be able to create instances via reflection.
29 @SuppressWarnings("checkstyle:RedundantModifier")
34 Proxy(final DeleteEntries deleteEntries) {
35 this.deleteEntries = deleteEntries;
39 public void writeExternal(final ObjectOutput out) throws IOException {
40 out.writeLong(deleteEntries.fromIndex);
44 public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
45 deleteEntries = new DeleteEntries(in.readLong());
48 private Object readResolve() {
53 private static final long serialVersionUID = 1L;
55 private final long fromIndex;
57 public DeleteEntries(final long fromIndex) {
58 this.fromIndex = fromIndex;
61 public long getFromIndex() {
65 private Object writeReplace() {
66 return new Proxy(this);
70 public String toString() {
71 return "DeleteEntries [fromIndex=" + fromIndex + "]";