Package com.graphaware.common.util
Class BlockingArrayBlockingQueue<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<E>
-
- java.util.concurrent.ArrayBlockingQueue<E>
-
- com.graphaware.common.util.BlockingArrayBlockingQueue<E>
-
- Type Parameters:
E
-
- All Implemented Interfaces:
Serializable
,Iterable<E>
,Collection<E>
,BlockingQueue<E>
,Queue<E>
public class BlockingArrayBlockingQueue<E> extends ArrayBlockingQueue<E>
ArrayBlockingQueue
that blocks for a specified amount of time onQueue.offer(Object)
, throwing aRuntimeException
upon timeout. The timeout is 30 minutes by default and can be changed by overridingtimeoutMinutes()
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BlockingArrayBlockingQueue(int capacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
offer(E e)
protected int
timeoutMinutes()
-
Methods inherited from class java.util.concurrent.ArrayBlockingQueue
add, clear, contains, drainTo, drainTo, forEach, iterator, offer, peek, poll, poll, put, remainingCapacity, remove, removeAll, removeIf, retainAll, size, spliterator, take, toArray, toArray, toString
-
Methods inherited from class java.util.AbstractQueue
addAll, element, remove
-
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
addAll, containsAll, equals, hashCode, isEmpty, parallelStream, stream, toArray
-
-
-
-
Method Detail
-
offer
public boolean offer(E e)
- Specified by:
offer
in interfaceBlockingQueue<E>
- Specified by:
offer
in interfaceQueue<E>
- Overrides:
offer
in classArrayBlockingQueue<E>
-
timeoutMinutes
protected int timeoutMinutes()
- Returns:
- number of minutes to block on offer, before throwing a
RuntimeException
.
-
-