Add Payload.serializedSize()
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / messages / Payload.java
index 78a249749dfce31d7a8625aced8d957de526ea0b..bda1d1e22ca1762f71f5c0516e6c23cfa07929be 100644 (file)
@@ -26,6 +26,15 @@ public abstract class Payload implements Serializable {
      */
     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.
      *