Remove Namespace.populate()
[controller.git] / third-party / atomix / storage / src / main / java / io / atomix / utils / serializer / Namespace.java
index 40210b168b6e5c76f46533e73539ade0e29bd6b0..dcad23d9f0f211332f58f7a32cb6452e8ae6bb8f 100644 (file)
@@ -108,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, friendlyName).populate(1);
+      return new Namespace(blocks, classLoader, friendlyName);
     }
 
     /**
@@ -161,20 +161,9 @@ public final class Namespace implements KryoFactory, KryoPool {
     this.registeredBlocks = ImmutableList.copyOf(registeredTypes);
     this.classLoader = classLoader;
     this.friendlyName = requireNonNull(friendlyName);
-  }
-
-  /**
-   * Populates the Kryo pool.
-   *
-   * @param instances to add to the pool
-   * @return this
-   */
-  public Namespace populate(int instances) {
 
-    for (int i = 0; i < instances; ++i) {
-      release(create());
-    }
-    return this;
+    // Pre-populate with a single instance
+    release(create());
   }
 
   /**
@@ -319,17 +308,6 @@ public final class Namespace implements KryoFactory, KryoPool {
     }
   }
 
-  /**
-   * Gets the number of classes registered in this Kryo namespace.
-   *
-   * @return size of namespace
-   */
-  public int size() {
-    return (int) registeredBlocks.stream()
-        .flatMap(block -> block.types().stream())
-        .count();
-  }
-
   /**
    * Creates a Kryo instance.
    *