X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fcds-access-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Faccess%2Fconcepts%2FMemberName.java;h=daab643f8a6e13647d7e92554718a49e70b14570;hb=HEAD;hp=f26df831836cc7852cf31f9fd8a826199ffa70b1;hpb=17072677c1de88e6864ae8828efd7b2f9037ef21;p=controller.git diff --git a/opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/MemberName.java b/opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/MemberName.java index f26df83183..daab643f8a 100644 --- a/opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/MemberName.java +++ b/opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/MemberName.java @@ -16,11 +16,7 @@ import com.google.common.base.Strings; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.io.DataInput; import java.io.DataOutput; -import java.io.Externalizable; import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.io.Serial; import java.nio.charset.StandardCharsets; import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.concepts.WritableIdentifier; @@ -29,43 +25,7 @@ import org.opendaylight.yangtools.concepts.WritableIdentifier; * Type-safe encapsulation of a cluster member name. */ public final class MemberName implements Comparable, WritableIdentifier { - private static final class Proxy implements Externalizable { - @Serial - private static final long serialVersionUID = 1L; - - private byte[] serialized; - - // checkstyle flags the public modifier as redundant however it is explicitly needed for Java serialization to - // be able to create instances via reflection. - @SuppressWarnings("checkstyle:RedundantModifier") - public Proxy() { - // For Externalizable - } - - Proxy(final byte[] serialized) { - this.serialized = requireNonNull(serialized); - } - - @Override - public void writeExternal(final ObjectOutput out) throws IOException { - out.writeInt(serialized.length); - out.write(serialized); - } - - @Override - public void readExternal(final ObjectInput in) throws IOException { - serialized = new byte[in.readInt()]; - in.readFully(serialized); - } - - @Serial - private Object readResolve() { - // TODO: consider caching instances here - return new MemberName(new String(serialized, StandardCharsets.UTF_8), serialized); - } - } - - @Serial + @java.io.Serial private static final long serialVersionUID = 1L; private final @NonNull String name; @@ -141,8 +101,8 @@ public final class MemberName implements Comparable, WritableIdentif return local; } - @Serial + @java.io.Serial Object writeReplace() { - return new Proxy(getSerialized()); + return new MN(getSerialized()); } }