Package com.db4o.foundation
Class PausableBlockingQueue<T>
- java.lang.Object
-
- com.db4o.foundation.BlockingQueue<T>
-
- com.db4o.foundation.PausableBlockingQueue<T>
-
- All Implemented Interfaces:
BlockingQueue4<T>,PausableBlockingQueue4<T>,Queue4<T>
- Direct Known Subclasses:
TimeoutBlockingQueue
public class PausableBlockingQueue<T> extends BlockingQueue<T> implements PausableBlockingQueue4<T>
-
-
Field Summary
-
Fields inherited from class com.db4o.foundation.BlockingQueue
_lock, _queue, _stopped
-
-
Constructor Summary
Constructors Constructor Description PausableBlockingQueue()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisPaused()booleanpause()Pauses the queue, making calls toQueue4.next()block untilPausableBlockingQueue4.resume()is called.booleanresume()Resumes the queue, releasing blocked calls toQueue4.next()that can reach a next queue item..TtryNext()Returns the next element in queue if there is one available, returns null otherwise.protected booleanunsafeWaitForNext(long timeout)-
Methods inherited from class com.db4o.foundation.BlockingQueue
add, drainTo, hasNext, iterator, next, next, nextMatching, stop, unsafeWaitForNext, waitForNext, waitForNext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.db4o.foundation.BlockingQueue4
drainTo, next, stop
-
-
-
-
Method Detail
-
pause
public boolean pause()
Description copied from interface:PausableBlockingQueue4Pauses the queue, making calls to
Queue4.next()block untilPausableBlockingQueue4.resume()is called.- Specified by:
pausein interfacePausableBlockingQueue4<T>- Returns:
- whether or not this call changed the state of the queue.
-
resume
public boolean resume()
Description copied from interface:PausableBlockingQueue4Resumes the queue, releasing blocked calls to
Queue4.next()that can reach a next queue item..- Specified by:
resumein interfacePausableBlockingQueue4<T>- Returns:
- whether or not this call changed the state of the queue.
-
isPaused
public boolean isPaused()
- Specified by:
isPausedin interfacePausableBlockingQueue4<T>
-
unsafeWaitForNext
protected boolean unsafeWaitForNext(long timeout) throws BlockingQueueStoppedException- Overrides:
unsafeWaitForNextin classBlockingQueue<T>- Throws:
BlockingQueueStoppedException
-
tryNext
public T tryNext()
Description copied from interface:PausableBlockingQueue4Returns the next element in queue if there is one available, returns null otherwise.
This method will not never block, regardless of the queue being paused or no elements are available.
- Specified by:
tryNextin interfacePausableBlockingQueue4<T>- Returns:
- next element, if available and queue not paused.
-
-