X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=third-party%2Fatomix%2Fstorage%2Fsrc%2Fmain%2Fjava%2Fio%2Fatomix%2Futils%2Fserializer%2FNamespace.java;h=33fc1717fb0d08dcdfb114135376a5724b94963b;hb=e840ea282204acf921e2af427467c15a23c96efe;hp=6942ba27138a8274443ce925c1a62b01799ff9c1;hpb=650b08e2767c28e99f03ffacd26c23a76ddd5338;p=controller.git 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 6942ba2713..33fc1717fb 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 @@ -23,7 +23,6 @@ import com.esotericsoftware.kryo.io.ByteBufferOutput; import com.esotericsoftware.kryo.pool.KryoCallback; import com.esotericsoftware.kryo.pool.KryoFactory; import com.esotericsoftware.kryo.pool.KryoPool; -import com.esotericsoftware.kryo.serializers.CompatibleFieldSerializer; import com.google.common.base.MoreObjects; import com.google.common.collect.ImmutableList; import org.objenesis.strategy.StdInstantiatorStrategy; @@ -56,11 +55,6 @@ public final class Namespace implements KryoFactory, KryoPool { */ public static final int DEFAULT_BUFFER_SIZE = 4096; - /** - * Maximum allowed buffer size. - */ - public static final int MAX_BUFFER_SIZE = 100 * 1000 * 1000; - /** * ID to use if this KryoNamespace does not define registration id. */ @@ -75,14 +69,7 @@ public final class Namespace implements KryoFactory, KryoPool { private static final Logger LOGGER = LoggerFactory.getLogger(Namespace.class); - /** - * Default Kryo namespace. - */ - public static final Namespace DEFAULT = builder().build(); - - private final KryoPool kryoPool = new KryoPool.Builder(this) - .softReferences() - .build(); + private final KryoPool kryoPool = new KryoPool.Builder(this).softReferences().build(); private final KryoOutputPool kryoOutputPool = new KryoOutputPool(); private final KryoInputPool kryoInputPool = new KryoInputPool(); @@ -90,7 +77,6 @@ public final class Namespace implements KryoFactory, KryoPool { private final ImmutableList registeredBlocks; private final ClassLoader classLoader; - private final boolean compatible; private final boolean registrationRequired; private final String friendlyName; @@ -104,7 +90,6 @@ public final class Namespace implements KryoFactory, KryoPool { private List blocks = new ArrayList<>(); private ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); private boolean registrationRequired = true; - private boolean compatible = false; /** * Builds a {@link Namespace} instance. @@ -125,7 +110,7 @@ public final class Namespace implements KryoFactory, KryoPool { if (!types.isEmpty()) { blocks.add(new RegistrationBlock(this.blockHeadId, types)); } - return new Namespace(blocks, classLoader, registrationRequired, compatible, friendlyName).populate(1); + return new Namespace(blocks, classLoader, registrationRequired, friendlyName).populate(1); } /** @@ -154,20 +139,6 @@ public final class Namespace implements KryoFactory, KryoPool { return this; } - /** - * Sets whether backwards/forwards compatible versioned serialization is enabled. - *

- * When compatible serialization is enabled, the {@link CompatibleFieldSerializer} will be set as the - * default serializer for types that do not otherwise explicitly specify a serializer. - * - * @param compatible whether versioned serialization is enabled - * @return this - */ - public Builder setCompatible(boolean compatible) { - this.compatible = compatible; - return this; - } - /** * Sets the registrationRequired flag. * @@ -195,19 +166,16 @@ public final class Namespace implements KryoFactory, KryoPool { * * @param registeredTypes types to register * @param registrationRequired whether registration is required - * @param compatible whether compatible serialization is enabled * @param friendlyName friendly name for the namespace */ private Namespace( final List registeredTypes, ClassLoader classLoader, boolean registrationRequired, - boolean compatible, String friendlyName) { this.registeredBlocks = ImmutableList.copyOf(registeredTypes); this.registrationRequired = registrationRequired; this.classLoader = classLoader; - this.compatible = compatible; this.friendlyName = requireNonNull(friendlyName); } @@ -394,11 +362,6 @@ public final class Namespace implements KryoFactory, KryoPool { kryo.setClassLoader(classLoader); kryo.setRegistrationRequired(registrationRequired); - // If compatible serialization is enabled, override the default serializer. - if (compatible) { - kryo.setDefaultSerializer(CompatibleFieldSerializer::new); - } - // TODO rethink whether we want to use StdInstantiatorStrategy kryo.setInstantiatorStrategy( new Kryo.DefaultInstantiatorStrategy(new StdInstantiatorStrategy()));