Remove Namespace.Builder.setCompatible()
[controller.git] / third-party / atomix / storage / src / main / java / io / atomix / utils / serializer / Namespace.java
index 6942ba27138a8274443ce925c1a62b01799ff9c1..a17db0a38b8e3d521698aa5111e6af6676d6002c 100644 (file)
@@ -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;
@@ -90,7 +89,6 @@ public final class Namespace implements KryoFactory, KryoPool {
   private final ImmutableList<RegistrationBlock> registeredBlocks;
 
   private final ClassLoader classLoader;
-  private final boolean compatible;
   private final boolean registrationRequired;
   private final String friendlyName;
 
@@ -104,7 +102,6 @@ public final class Namespace implements KryoFactory, KryoPool {
     private List<RegistrationBlock> blocks = new ArrayList<>();
     private ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
     private boolean registrationRequired = true;
-    private boolean compatible = false;
 
     /**
      * Builds a {@link Namespace} instance.
@@ -125,7 +122,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 +151,6 @@ public final class Namespace implements KryoFactory, KryoPool {
       return this;
     }
 
-    /**
-     * Sets whether backwards/forwards compatible versioned serialization is enabled.
-     * <p>
-     * 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 +178,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<RegistrationBlock> 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 +374,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()));