Add Payload.serializedSize()
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / persisted / DisableTrackingPayload.java
index 29dd0725245e761a2551a2cf00bab41b6c6e35f8..d8684fef985b0b04600dcfd2e8a7f27f0eefc66e 100644 (file)
@@ -40,6 +40,7 @@ public final class DisableTrackingPayload extends AbstractIdentifiablePayload<Cl
 
     private static final Logger LOG = LoggerFactory.getLogger(DisableTrackingPayload.class);
     private static final long serialVersionUID = 1L;
+    private static final int PROXY_SIZE = externalizableProxySize(Proxy::new);
 
     DisableTrackingPayload(final ClientIdentifier clientId, final byte[] serialized) {
         super(clientId, serialized);
@@ -53,7 +54,7 @@ public final class DisableTrackingPayload extends AbstractIdentifiablePayload<Cl
         } catch (IOException e) {
             // This should never happen
             LOG.error("Failed to serialize {}", clientId, e);
-            throw new RuntimeException("Failed to serialize " + clientId, e);
+            throw new IllegalStateException("Failed to serialize " + clientId, e);
         }
         return new DisableTrackingPayload(clientId, out.toByteArray());
     }
@@ -62,4 +63,9 @@ public final class DisableTrackingPayload extends AbstractIdentifiablePayload<Cl
     protected Proxy externalizableProxy(final byte[] serialized) {
         return new Proxy(serialized);
     }
+
+    @Override
+    protected int externalizableProxySize() {
+        return PROXY_SIZE;
+    }
 }