Fix followerDistributedDataStore tear down
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / persisted / NoopPayload.java
1 /*
2  * Copyright (c) 2016 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.persisted;
9
10 import akka.dispatch.ControlMessage;
11 import java.io.Serializable;
12 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
13
14 /**
15  * Payload used for no-op log entries that are put into the journal by the PreLeader in order to commit
16  * entries from the prior term.
17  *
18  * @author Thomas Pantelis
19  */
20 public final class NoopPayload extends Payload implements Serializable, ControlMessage {
21     public static final NoopPayload INSTANCE = new NoopPayload();
22
23     // There is no need for Externalizable
24     private static final class Proxy implements Serializable {
25         private static final long serialVersionUID = 1L;
26
27         private Object readResolve() {
28             return INSTANCE;
29         }
30     }
31
32     private static final long serialVersionUID = 1L;
33     private static final Proxy PROXY = new Proxy();
34
35     private NoopPayload() {
36     }
37
38     @Override
39     public int size() {
40         return 0;
41     }
42
43     private Object writeReplace() {
44         return PROXY;
45     }
46 }