Class MpmcArrayQueue<E>

java.lang.Object
icyllis.modernui.util.MpmcArrayQueue<E>
All Implemented Interfaces:
Pools.Pool<E>

@ThreadSafe public class MpmcArrayQueue<E> extends Object implements Pools.Pool<E>
  • Constructor Details

    • MpmcArrayQueue

      public MpmcArrayQueue(int capacity)
  • Method Details

    • size

      public int size()
    • isEmpty

      public boolean isEmpty()
    • isFull

      public boolean isFull()
    • acquire

      @Nullable public E acquire()
      Specified by:
      acquire in interface Pools.Pool<E>
      Returns:
      An instance from the pool if such, null otherwise.
    • release

      public boolean release(@NonNull E instance)
      Description copied from interface: Pools.Pool
      Release an instance to the pool.
      Specified by:
      release in interface Pools.Pool<E>
      Parameters:
      instance - The instance to release.
      Returns:
      Whether the instance was put in the pool.