Package com.db4o.foundation
Class DelegatingBlockingQueue<T>
- java.lang.Object
-
- com.db4o.foundation.DelegatingBlockingQueue<T>
-
- All Implemented Interfaces:
BlockingQueue4<T>,Queue4<T>
public class DelegatingBlockingQueue<T> extends java.lang.Object implements BlockingQueue4<T>
-
-
Constructor Summary
Constructors Constructor Description DelegatingBlockingQueue(BlockingQueue4<T> queue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(T obj)intdrainTo(Collection4<T> list)Removes all the available elements in the queue to the colletion passed as argument.booleanhasNext()Iterator4iterator()Tnext()Tnext(long timeout)Returns the next queued item or waits for it to be available for the maximum oftimeoutmiliseconds.TnextMatching(Predicate4<T> condition)Returns the next object in the queue that matches the specified condition.voidstop()
-
-
-
Constructor Detail
-
DelegatingBlockingQueue
public DelegatingBlockingQueue(BlockingQueue4<T> queue)
-
-
Method Detail
-
next
public T next(long timeout) throws BlockingQueueStoppedException
Description copied from interface:BlockingQueue4Returns the next queued item or waits for it to be available for the maximum of
timeoutmiliseconds.- Specified by:
nextin interfaceBlockingQueue4<T>- Parameters:
timeout- maximum time to wait for the next avilable item in miliseconds- Returns:
- the next item or
nulliftimeoutis reached - Throws:
BlockingQueueStoppedException- if theBlockingQueue4.stop()is called.
-
nextMatching
public T nextMatching(Predicate4<T> condition)
Description copied from interface:Queue4Returns the next object in the queue that matches the specified condition. The operation is always NON-BLOCKING.- Specified by:
nextMatchingin interfaceQueue4<T>- Parameters:
condition- the object must satisfy to be returned- Returns:
- the object satisfying the condition or null if none does
-
stop
public void stop()
- Specified by:
stopin interfaceBlockingQueue4<T>
-
drainTo
public int drainTo(Collection4<T> list)
Description copied from interface:BlockingQueue4Removes all the available elements in the queue to the colletion passed as argument.
It will block until at least one element is available.
- Specified by:
drainToin interfaceBlockingQueue4<T>- Returns:
- the number of elements added to the list.
-
-