Class SizeBlockingQueue<E>

<E>
<E>
org.elasticsearch.common.util.concurrent.SizeBlockingQueue<E>
All Implemented Interfaces:
<E>, <E>, <E>, <E>

public class SizeBlockingQueue<E> extends <E> implements <E>
A size based queue wrapping another blocking queue to provide (somewhat relaxed) capacity checks. Mainly makes sense to use with blocking queues that are unbounded to provide the ability to do capacity verification.
  • Constructor Summary

    Constructors
    Constructor
    Description
    <E> queue, int capacity)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    boolean
     o)
     
    boolean
    <?> c)
     
    int
    <? super E> c)
     
    int
    <? super E> c, int maxElements)
     
    void
    forcePut​(E e)
    Forces adding an element to the queue, without doing size checks.
    <E>
     
    boolean
    offer​(E e)
     
    boolean
    offer​(E e, long timeout,  unit)
     
     
     
    poll​(long timeout,  unit)
     
    void
    put​(E e)
     
    int
     
    boolean
     o)
     
    int
     
     
    []
     
    <T> T[]
    toArray​(T[] a)
     

    Methods inherited from class java.util.

    , , , ,

    Methods inherited from class java.util.

    , , ,

    Methods inherited from class java.lang.

    , , , , , , , , ,

    Methods inherited from interface java.util.concurrent.

    Methods inherited from interface java.util.

    , , , , , , , , , , ,

    Methods inherited from interface java.lang.

    Methods inherited from interface java.util.

    ,
  • Constructor Details

    • SizeBlockingQueue

      public SizeBlockingQueue(<E> queue, int capacity)
  • Method Details

    • size

      public int size()
      Specified by:
       in interface <E>
      Specified by:
       in class <E>
    • capacity

      public int capacity()
    • iterator

      public <E> iterator()
      Specified by:
       in interface <E>
      Specified by:
       in interface <E>
      Specified by:
       in class <E>
    • peek

      public E peek()
      Specified by:
       in interface <E>
    • poll

      public E poll()
      Specified by:
       in interface <E>
    • poll

      public E poll(long timeout,  unit) throws
      Specified by:
       in interface <E>
      Throws:
    • remove

      public boolean remove( o)
      Specified by:
       in interface <E>
      Specified by:
       in interface <E>
      Overrides:
       in class <E>
    • forcePut

      public void forcePut(E e) throws
      Forces adding an element to the queue, without doing size checks.
      Throws:
    • offer

      public boolean offer(E e)
      Specified by:
       in interface <E>
      Specified by:
       in interface <E>
    • offer

      public boolean offer(E e, long timeout,  unit) throws
      Specified by:
       in interface <E>
      Throws:
    • put

      public void put(E e) throws
      Specified by:
       in interface <E>
      Throws:
    • take

      public E take() throws
      Specified by:
       in interface <E>
      Throws:
    • remainingCapacity

      public int remainingCapacity()
      Specified by:
       in interface <E>
    • drainTo

      public int drainTo(<? super E> c)
      Specified by:
       in interface <E>
    • drainTo

      public int drainTo(<? super E> c, int maxElements)
      Specified by:
       in interface <E>
    • toArray

      public [] toArray()
      Specified by:
       in interface <E>
      Overrides:
       in class <E>
    • toArray

      public <T> T[] toArray(T[] a)
      Specified by:
       in interface <E>
      Overrides:
       in class <E>
    • contains

      public boolean contains( o)
      Specified by:
       in interface <E>
      Specified by:
       in interface <E>
      Overrides:
       in class <E>
    • containsAll

      public boolean containsAll(<?> c)
      Specified by:
       in interface <E>
      Overrides:
       in class <E>