From 6d24017118b3283a10c816f27c778cbef1f39a35 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Thu, 2 Mar 2023 17:18:05 +0100 Subject: [PATCH] Remove Namespace.Builder.setRegistrationRequired() We want users to always register serializers, remove the option to not do so. JIRA: CONTROLLER-2072 Change-Id: I8aeb47045353b058556498bc4e6b64307646d924 Signed-off-by: Robert Varga --- .../io/atomix/utils/serializer/Namespace.java | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/Namespace.java b/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/Namespace.java index 33fc1717fb..a37195dadf 100644 --- a/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/Namespace.java +++ b/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/Namespace.java @@ -77,7 +77,6 @@ public final class Namespace implements KryoFactory, KryoPool { private final ImmutableList registeredBlocks; private final ClassLoader classLoader; - private final boolean registrationRequired; private final String friendlyName; /** @@ -89,7 +88,6 @@ public final class Namespace implements KryoFactory, KryoPool { private List[], Serializer>> types = new ArrayList<>(); private List blocks = new ArrayList<>(); private ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - private boolean registrationRequired = true; /** * Builds a {@link Namespace} instance. @@ -110,7 +108,7 @@ public final class Namespace implements KryoFactory, KryoPool { if (!types.isEmpty()) { blocks.add(new RegistrationBlock(this.blockHeadId, types)); } - return new Namespace(blocks, classLoader, registrationRequired, friendlyName).populate(1); + return new Namespace(blocks, classLoader, friendlyName).populate(1); } /** @@ -138,18 +136,6 @@ public final class Namespace implements KryoFactory, KryoPool { this.classLoader = classLoader; return this; } - - /** - * Sets the registrationRequired flag. - * - * @param registrationRequired Kryo's registrationRequired flag - * @return this - * @see Kryo#setRegistrationRequired(boolean) - */ - public Builder setRegistrationRequired(boolean registrationRequired) { - this.registrationRequired = registrationRequired; - return this; - } } /** @@ -171,10 +157,8 @@ public final class Namespace implements KryoFactory, KryoPool { private Namespace( final List registeredTypes, ClassLoader classLoader, - boolean registrationRequired, String friendlyName) { this.registeredBlocks = ImmutableList.copyOf(registeredTypes); - this.registrationRequired = registrationRequired; this.classLoader = classLoader; this.friendlyName = requireNonNull(friendlyName); } @@ -360,7 +344,7 @@ public final class Namespace implements KryoFactory, KryoPool { LOGGER.trace("Creating Kryo instance for {}", this); Kryo kryo = new Kryo(); kryo.setClassLoader(classLoader); - kryo.setRegistrationRequired(registrationRequired); + kryo.setRegistrationRequired(true); // TODO rethink whether we want to use StdInstantiatorStrategy kryo.setInstantiatorStrategy( -- 2.36.6