Package kieker.monitoring.queue
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 intdrainTo(java.util.Collection<? super E> c)intdrainTo(java.util.Collection<? super E> c, int maxElements)java.util.Iterator<E>iterator()booleanoffer(E e)booleanoffer(E e, long timeout, java.util.concurrent.TimeUnit unit)Epeek()Epoll()Epoll(long timeout, java.util.concurrent.TimeUnit unit)voidput(E e)intremainingCapacity()intsize()Etake()java.lang.StringtoString()Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
BlockingQueueDecorator
public BlockingQueueDecorator(java.util.Queue<E> q, PutStrategy putStrategy, TakeStrategy takeStrategy)
-
-
Method Details
-
put
- Specified by:
putin interfacejava.util.concurrent.BlockingQueue<E>- Throws:
java.lang.InterruptedException
-
offer
-
take
- Specified by:
takein interfacejava.util.concurrent.BlockingQueue<E>- Throws:
java.lang.InterruptedException
-
poll
- Specified by:
pollin interfacejava.util.Queue<E>
-
offer
public boolean offer(E e, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException- Specified by:
offerin interfacejava.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:
pollin interfacejava.util.concurrent.BlockingQueue<E>- Throws:
java.lang.InterruptedException
-
remainingCapacity
public int remainingCapacity()- Specified by:
remainingCapacityin interfacejava.util.concurrent.BlockingQueue<E>
-
drainTo
- Specified by:
drainToin interfacejava.util.concurrent.BlockingQueue<E>
-
drainTo
- Specified by:
drainToin interfacejava.util.concurrent.BlockingQueue<E>
-
peek
- Specified by:
peekin interfacejava.util.Queue<E>
-
iterator
-
size
public int size() -
toString
public java.lang.String toString()- Overrides:
toStringin classjava.util.AbstractCollection<E>
-