X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2Fmessages%2FPayload.java;h=c75385ab1ea4f83e298d0ac1b6289b7f691a877e;hb=HEAD;hp=b70eace11c835dc8beccb75e7c6b77ae922683c7;hpb=534bf6f83465cc8a575b097c1e28fbb1f34d110a;p=controller.git diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/Payload.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/Payload.java index b70eace11c..c75385ab1e 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/Payload.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/Payload.java @@ -7,6 +7,8 @@ */ package org.opendaylight.controller.cluster.raft.messages; +import java.io.Serializable; + /** * An instance of a {@link Payload} class is meant to be used as the Payload for {@link AppendEntries}. * @@ -14,11 +16,31 @@ package org.opendaylight.controller.cluster.raft.messages; * When an actor which is derived from RaftActor attempts to persistData it must pass an instance of the Payload class. * Similarly when state needs to be applied to the derived RaftActor it will be passed an instance of the Payload class. */ -public abstract class Payload { +public abstract class Payload implements Serializable { + @java.io.Serial + private static final long serialVersionUID = 1L; + /** * Return the estimate of in-memory size of this payload. * * @return An estimate of the in-memory size of this payload. */ public abstract int size(); + + /** + * Return the estimate of serialized size of this payload when passed through serialization. The estimate needs to + * be reasonably accurate and should err on the side of caution and report a slightly-higher size in face of + * uncertainty. + * + * @return An estimate of serialized size. + */ + public abstract int serializedSize(); + + /** + * Return the serialization proxy for this object. + * + * @return Serialization proxy + */ + @java.io.Serial + protected abstract Object writeReplace(); }