Class MultithreadConcurrentQueueCollection<T>

java.lang.Object
org.vibur.objectpool.util.MultithreadConcurrentQueueCollection<T>
Type Parameters:
T - the type of objects held in this ConcurrentCollection
All Implemented Interfaces:
ConcurrentCollection<T>

public class MultithreadConcurrentQueueCollection<T> extends Object implements ConcurrentCollection<T>
A MultithreadConcurrentQueue based implementation of ConcurrentCollection.
Author:
Simeon Malchev
  • Constructor Details

    • MultithreadConcurrentQueueCollection

      public MultithreadConcurrentQueueCollection(int capacity)
  • Method Details

    • offerFirst

      public void offerFirst(T object)
      Description copied from interface: ConcurrentCollection
      Adds the given object at the head of the ConcurrentCollection.
      Specified by:
      offerFirst in interface ConcurrentCollection<T>
      Parameters:
      object - the given object
    • offerLast

      public void offerLast(T object)
      Description copied from interface: ConcurrentCollection
      Adds the given object at the tail of the ConcurrentCollection.
      Specified by:
      offerLast in interface ConcurrentCollection<T>
      Parameters:
      object - the given object
    • pollFirst

      public T pollFirst()
      Description copied from interface: ConcurrentCollection
      Polls an object from the head of the ConcurrentCollection.
      Specified by:
      pollFirst in interface ConcurrentCollection<T>
      Returns:
      the head Collection object if available; null otherwise
    • pollLast

      public T pollLast()
      Description copied from interface: ConcurrentCollection
      Polls an object from the tail of the ConcurrentCollection.
      Specified by:
      pollLast in interface ConcurrentCollection<T>
      Returns:
      the tail Collection object if available; null otherwise
    • size

      public int size()
      Description copied from interface: ConcurrentCollection
      Returns the number of elements in this collection.
      Specified by:
      size in interface ConcurrentCollection<T>
      Returns:
      the number of elements in this collection