Interface Pool.Factory

Enclosing interface:
Pool<T>

public static interface Pool.Factory
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> Pool<T>
    create(int nSize, Supplier<T> itemFactory, Consumer<T> clearingProcedure)
    Creates a new pool.
  • Method Details

    • create

      <T> Pool<T> create(int nSize, Supplier<T> itemFactory, Consumer<T> clearingProcedure)
      Creates a new pool.
      Parameters:
      nSize - A hint of the maximum number of items expected to be taken from the pool at once. The behavior when more items are taken depends on the pool. The pool may preallocate this many items. When the maximum can't be given, use 0.
      itemFactory - Creates new items. May be null if items will be given rather than created.
      clearingProcedure - Called on each item given to the pool to clear the fields of the item. May be null.