public class PausableBlockingQueue<T> extends BlockingQueue<T> implements PausableBlockingQueue4<T>
_lock, _queue, _stopped| Constructor and Description |
|---|
PausableBlockingQueue() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isPaused() |
boolean |
pause()
Pauses the queue, making calls to
Queue4.next() block
until PausableBlockingQueue4.resume() is called. |
boolean |
resume()
Resumes the queue, releasing blocked calls to
Queue4.next() that can reach a next queue item.. |
T |
tryNext()
Returns the next element in queue if there is one available, returns null
otherwise.
|
protected boolean |
unsafeWaitForNext(long timeout) |
add, drainTo, hasNext, iterator, next, next, nextMatching, stop, unsafeWaitForNext, waitForNext, waitForNextclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdrainTo, next, stoppublic boolean pause()
PausableBlockingQueue4
Pauses the queue, making calls to Queue4.next() block
until PausableBlockingQueue4.resume() is called.
pause in interface PausableBlockingQueue4<T>public boolean resume()
PausableBlockingQueue4
Resumes the queue, releasing blocked calls to
Queue4.next() that can reach a next queue item..
resume in interface PausableBlockingQueue4<T>public boolean isPaused()
isPaused in interface PausableBlockingQueue4<T>protected boolean unsafeWaitForNext(long timeout)
throws BlockingQueueStoppedException
unsafeWaitForNext in class BlockingQueue<T>BlockingQueueStoppedExceptionpublic T tryNext()
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.
tryNext in interface PausableBlockingQueue4<T>