Package gov.usgs.earthquake.util
Class RoundRobinBlockingQueue<T>
java.lang.Object
gov.usgs.earthquake.util.RoundRobinQueue<T>
gov.usgs.earthquake.util.RoundRobinBlockingQueue<T>
- Type Parameters:
- T- queue item type.
- All Implemented Interfaces:
- Iterable<T>,- Collection<T>,- BlockingQueue<T>,- Queue<T>
- Direct Known Subclasses:
- ListenerNotificationQueue,- NotificationEventBlockingQueue
Round Robin Blocking Queue.
 
put(Object) and take() are recommended, as other methods
 internally call these methods.- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanAdd an item to the queue.booleanCheck if queue contains an item.intdrainTo(Collection<? super T> c) Empty queue into a collection.intdrainTo(Collection<? super T> c, int max) Empty queue into a collection, stopping after max elements.booleanOffer an item to the queue.booleanOffer an item to the queue.Retrieves and removes the head of this queue, waiting up to the specified wait time if necessary for an element to become available.voidPut an item in the queue.intUnbounded queues return Integer.MAX_VALUE.booleanRemove an object from the queue.take()Remove an object from the queue.Methods inherited from class gov.usgs.earthquake.util.RoundRobinQueueaddAll, clear, containsAll, element, getQueueId, isEmpty, iterator, peek, poll, remove, removeAll, retainAll, size, toArray, toArray, toListMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.CollectionaddAll, clear, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray
- 
Constructor Details- 
RoundRobinBlockingQueuepublic RoundRobinBlockingQueue()Constructor
 
- 
- 
Method Details- 
addAdd an item to the queue.- Specified by:
- addin interface- BlockingQueue<T>
- Specified by:
- addin interface- Collection<T>
- Specified by:
- addin interface- Queue<T>
- Overrides:
- addin class- RoundRobinQueue<T>
- Parameters:
- e- item to add
- Returns:
- true if added.
 
- 
containsCheck if queue contains an item.- Specified by:
- containsin interface- BlockingQueue<T>
- Specified by:
- containsin interface- Collection<T>
- Overrides:
- containsin class- RoundRobinQueue<T>
 
- 
offerOffer an item to the queue. Callsadd(Object), but returns false if any exceptions thrown.- Specified by:
- offerin interface- BlockingQueue<T>
- Specified by:
- offerin interface- Queue<T>
- Overrides:
- offerin class- RoundRobinQueue<T>
- Parameters:
- e- item to add
- Returns:
- true if added, false otherwise.
 
- 
offerOffer an item to the queue. Same asoffer(Object), this is an unbounded queue.- Specified by:
- offerin interface- BlockingQueue<T>
- Throws:
- InterruptedException
 
- 
pollRetrieves and removes the head of this queue, waiting up to the specified wait time if necessary for an element to become available.- Specified by:
- pollin interface- BlockingQueue<T>
- Throws:
- InterruptedException
 
- 
putPut an item in the queue.- Specified by:
- putin interface- BlockingQueue<T>
- Throws:
- InterruptedException- if interrupted while acquiring lock.
 
- 
remainingCapacitypublic int remainingCapacity()Unbounded queues return Integer.MAX_VALUE.- Specified by:
- remainingCapacityin interface- BlockingQueue<T>
- Returns:
- Integer.MAX_VALUE;
 
- 
removeRemove an object from the queue.- Specified by:
- removein interface- BlockingQueue<T>
- Specified by:
- removein interface- Collection<T>
- Overrides:
- removein class- RoundRobinQueue<T>
 
- 
takeRemove an object from the queue.- Specified by:
- takein interface- BlockingQueue<T>
- Throws:
- InterruptedException
 
- 
drainToEmpty queue into a collection.- Specified by:
- drainToin interface- BlockingQueue<T>
 
- 
drainToEmpty queue into a collection, stopping after max elements.- Specified by:
- drainToin interface- BlockingQueue<T>
 
 
-