Class ResourcePool<T>

java.lang.Object
com.yahoo.yolean.concurrent.ResourcePool<T>
All Implemented Interfaces:
Iterable<T>

public final class ResourcePool<T> extends Object implements Iterable<T>

This implements a simple stack based resource pool. If you are out of resources new are allocated from the factory.

Since:
5.2
Author:
baldersheim
  • Constructor Details

    • ResourcePool

      public ResourcePool(Supplier<T> factory)
  • Method Details

    • alloc

      public T alloc()
    • free

      public void free(T e)
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>