Do not allow recursive Namespace registration 25/104725/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 2 Mar 2023 13:51:05 +0000 (14:51 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 2 Mar 2023 13:51:46 +0000 (14:51 +0100)
We are not combining namespaces, there is no need for this method.

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

index 65ea034d1381e870ba7b48220dcc26a74dc328ac..1d460f6532a8e981e50934ec3457bb72febf4bb6 100644 (file)
@@ -179,41 +179,6 @@ public final class Namespace implements KryoFactory, KryoPool {
       return this;
     }
 
-    private Builder register(RegistrationBlock block) {
-      if (block.begin() != FLOATING_ID) {
-        // flush pending types
-        nextId(block.begin());
-        blocks.add(block);
-        nextId(block.begin() + block.types().size());
-      } else {
-        // flush pending types
-        final int addedBlockBegin = blockHeadId + types.size();
-        nextId(addedBlockBegin);
-        blocks.add(new RegistrationBlock(addedBlockBegin, block.types()));
-        nextId(addedBlockBegin + block.types().size());
-      }
-      return this;
-    }
-
-    /**
-     * Registers all the class registered to given KryoNamespace.
-     *
-     * @param ns KryoNamespace
-     * @return this
-     */
-    public Builder register(final Namespace ns) {
-
-      if (blocks.containsAll(ns.registeredBlocks)) {
-        // Everything was already registered.
-        LOGGER.debug("Ignoring {}, already registered.", ns);
-        return this;
-      }
-      for (RegistrationBlock block : ns.registeredBlocks) {
-        this.register(block);
-      }
-      return this;
-    }
-
     /**
      * Sets the namespace class loader.
      *