Class BlockingQueueDecorator<E>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<E>
kieker.monitoring.queue.BlockingQueueDecorator<E>
Type Parameters:
E - the type of the elements in the given queue
All Implemented Interfaces:
java.lang.Iterable<E>, java.util.Collection<E>, java.util.concurrent.BlockingQueue<E>, java.util.Queue<E>

public class BlockingQueueDecorator<E>
extends java.util.AbstractQueue<E>
implements java.util.concurrent.BlockingQueue<E>
A wrapper to provide a given queue a strategy to put and to take possibly in blocking mode.
Since:
1.13
Author:
Christian Wulf
  • Constructor Summary

    Constructors 
    Constructor Description
    BlockingQueueDecorator​(java.util.Queue<E> q, PutStrategy putStrategy, TakeStrategy takeStrategy)  
  • Method Summary

    Modifier and Type Method Description
    int drainTo​(java.util.Collection<? super E> c)  
    int drainTo​(java.util.Collection<? super E> c, int maxElements)  
    java.util.Iterator<E> iterator()  
    boolean offer​(E e)  
    boolean offer​(E e, long timeout, java.util.concurrent.TimeUnit unit)  
    E peek()  
    E poll()  
    E poll​(long timeout, java.util.concurrent.TimeUnit unit)  
    void put​(E e)  
    int remainingCapacity()  
    int size()  
    E take()  
    java.lang.String toString()  

    Methods inherited from class java.util.AbstractQueue

    add, addAll, clear, element, remove

    Methods inherited from class java.util.AbstractCollection

    contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.util.concurrent.BlockingQueue

    add, contains, remove

    Methods inherited from interface java.util.Collection

    addAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray

    Methods inherited from interface java.lang.Iterable

    forEach

    Methods inherited from interface java.util.Queue

    element, remove
  • Constructor Details

  • Method Details

    • put

      public void put​(E e) throws java.lang.InterruptedException
      Specified by:
      put in interface java.util.concurrent.BlockingQueue<E>
      Throws:
      java.lang.InterruptedException
    • offer

      public boolean offer​(E e)
      Specified by:
      offer in interface java.util.concurrent.BlockingQueue<E>
      Specified by:
      offer in interface java.util.Queue<E>
    • take

      public E take() throws java.lang.InterruptedException
      Specified by:
      take in interface java.util.concurrent.BlockingQueue<E>
      Throws:
      java.lang.InterruptedException
    • poll

      public E poll()
      Specified by:
      poll in interface java.util.Queue<E>
    • offer

      public boolean offer​(E e, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
      Specified by:
      offer in interface java.util.concurrent.BlockingQueue<E>
      Throws:
      java.lang.InterruptedException
    • poll

      public E poll​(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
      Specified by:
      poll in interface java.util.concurrent.BlockingQueue<E>
      Throws:
      java.lang.InterruptedException
    • remainingCapacity

      public int remainingCapacity()
      Specified by:
      remainingCapacity in interface java.util.concurrent.BlockingQueue<E>
    • drainTo

      public int drainTo​(java.util.Collection<? super E> c)
      Specified by:
      drainTo in interface java.util.concurrent.BlockingQueue<E>
    • drainTo

      public int drainTo​(java.util.Collection<? super E> c, int maxElements)
      Specified by:
      drainTo in interface java.util.concurrent.BlockingQueue<E>
    • peek

      public E peek()
      Specified by:
      peek in interface java.util.Queue<E>
    • iterator

      public java.util.Iterator<E> iterator()
      Specified by:
      iterator in interface java.util.Collection<E>
      Specified by:
      iterator in interface java.lang.Iterable<E>
      Specified by:
      iterator in class java.util.AbstractCollection<E>
    • size

      public int size()
      Specified by:
      size in interface java.util.Collection<E>
      Specified by:
      size in class java.util.AbstractCollection<E>
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.util.AbstractCollection<E>