Remove Namespace.Builder.nextId() 29/104729/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 2 Mar 2023 16:00:59 +0000 (17:00 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 2 Mar 2023 16:05:59 +0000 (17:05 +0100)
The facility to assign ids is not used by us, remove it, as it seems to
be a leak from Kryo.

JIRA: CONTROLLER-2072
Change-Id: I5069e3c0dfa395a56c98498d566b615651bda820
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/Namespace.java

index b9eeaf269c9dad75bb06026c8af7a61474daf6c9..6942ba27138a8274443ce925c1a62b01799ff9c1 100644 (file)
@@ -64,12 +64,12 @@ public final class Namespace implements KryoFactory, KryoPool {
   /**
    * ID to use if this KryoNamespace does not define registration id.
    */
   /**
    * ID to use if this KryoNamespace does not define registration id.
    */
-  public static final int FLOATING_ID = -1;
+  private static final int FLOATING_ID = -1;
 
   /**
    * Smallest ID free to use for user defined registrations.
    */
 
   /**
    * Smallest ID free to use for user defined registrations.
    */
-  public static final int INITIAL_ID = 16;
+  private static final int INITIAL_ID = 16;
 
   static final String NO_NAME = "(no name)";
 
 
   static final String NO_NAME = "(no name)";
 
@@ -128,30 +128,6 @@ public final class Namespace implements KryoFactory, KryoPool {
       return new Namespace(blocks, classLoader, registrationRequired, compatible, friendlyName).populate(1);
     }
 
       return new Namespace(blocks, classLoader, registrationRequired, compatible, friendlyName).populate(1);
     }
 
-    /**
-     * Sets the next Kryo registration Id for following register entries.
-     *
-     * @param id Kryo registration Id
-     * @return this
-     * @see Kryo#register(Class, Serializer, int)
-     */
-    public Builder nextId(final int id) {
-      if (!types.isEmpty()) {
-        if (id != FLOATING_ID && id < blockHeadId + types.size()) {
-
-          if (LOGGER.isWarnEnabled()) {
-            LOGGER.warn("requested nextId {} could potentially overlap "
-                    + "with existing registrations {}+{} ",
-                id, blockHeadId, types.size(), new RuntimeException());
-          }
-        }
-        blocks.add(new RegistrationBlock(this.blockHeadId, types));
-        types = new ArrayList<>();
-      }
-      this.blockHeadId = id;
-      return this;
-    }
-
     /**
      * Registers serializer for the given set of classes.
      * <p>
     /**
      * Registers serializer for the given set of classes.
      * <p>