Move ServerConfigurationPayload to cluster.raft.persisted
[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 java.io.Serializable;
11 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
12
13 /**
14  * Payload used for no-op log entries that are put into the journal by the PreLeader in order to commit
15  * entries from the prior term.
16  *
17  * @author Thomas Pantelis
18  */
19 public final class NoopPayload extends Payload implements Serializable {
20     public static final NoopPayload INSTANCE = new NoopPayload();
21
22     // There is no need for Externalizable
23     private static final class Proxy implements Serializable {
24         private static final long serialVersionUID = 1L;
25
26         @SuppressWarnings("static-method")
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     @SuppressWarnings("static-method")
44     private Object writeReplace() {
45         return PROXY;
46     }
47 }

©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.