Bug 5740: Change TimeoutNow and Shutdown to externalizable proxy
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / base / messages / TimeoutNow.java
index 5a753c24c99efe224b752299cfcdfc25168915f7..b85d8b7008393e0eac64c0c70bb6fa8a7ab95820 100644 (file)
@@ -22,7 +22,18 @@ public final class TimeoutNow implements Serializable {
         // Hidden on purpose
     }
 
-    private Object readResolve() {
-        return INSTANCE;
+    private Object writeReplace() {
+        return new Proxy();
+    }
+
+    private static class Proxy extends EmptyExternalizableProxy {
+        private static final long serialVersionUID = 1L;
+
+        // checkstyle flags the public modifier as redundant which really doesn't make sense since it clearly isn't
+        // redundant. It is explicitly needed for Java serialization to be able to create instances via reflection.
+        @SuppressWarnings("checkstyle:RedundantModifier")
+        public Proxy() {
+            super(INSTANCE);
+        }
     }
 }