Bug 5504: Add PreLeader raft state
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / persisted / NoopPayload.java
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/NoopPayload.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/NoopPayload.java
new file mode 100644 (file)
index 0000000..2393a30
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.raft.persisted;
+
+import java.io.Serializable;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+
+/**
+ * Payload used for no-op log entries that are put into the journal by the PreLeader in order to commit
+ * entries from the prior term.
+ *
+ * @author Thomas Pantelis
+ */
+public final class NoopPayload extends Payload implements Serializable {
+    private static final long serialVersionUID = 1L;
+    public static final NoopPayload INSTANCE = new NoopPayload();
+
+    private NoopPayload() {
+    }
+
+    @Override
+    public int size() {
+        return 0;
+    }
+
+    private Object readResolve() {
+        return INSTANCE;
+    }
+}