Modifier | Constructor and Description |
---|---|
protected |
BlockingQueueAccessor()
Creates a new
BlockingQueueAccessor with a queue size of 100}. |
protected |
BlockingQueueAccessor(int queueSize)
Creates a new
BlockingQueueAccessor with the given queue size. |
Modifier and Type | Method and Description |
---|---|
E |
get()
Retrieves and removes the head of the queue.
This is a blocking operation! |
E |
get(long timeoutMillis)
Retrieves and removes the head of the queue, waiting up to
timeoutMillis milliseconds if necessary. |
protected BlockingQueue<E> |
getBlockingQueue() |
E |
getWithTimeout(long timeoutMillis)
Retrieves and removes the head of the queue, waiting up to
timeoutMillis milliseconds if necessary. |
void |
put(E element)
Puts the given
element into the queue.This is a blocking operation! |
boolean |
put(E element,
long timeoutMillis)
Puts the given
element into the queue, waiting up to timeoutMillis milliseconds if necessary.This is a blocking operation! |
void |
putWithTimeout(E element,
long timeoutMillis)
Puts the given
element into the queue, waiting up to timeoutMillis milliseconds if necessary. |
protected BlockingQueueAccessor(int queueSize)
BlockingQueueAccessor
with the given queue size.queueSize
- the size of the internal BlockingQueue
protected BlockingQueueAccessor()
BlockingQueueAccessor
with a queue size of 100}.public void put(E element) throws InterruptedException
element
into the queue.element
- the element of type <E>
to put to the queueInterruptedException
- if interrupted while waitingpublic boolean put(E element, long timeoutMillis) throws InterruptedException
element
into the queue, waiting up to timeoutMillis
milliseconds if necessary.element
- the element of type <E>
to put into the queuetimeoutMillis
- the time to wait in millisecondstrue
if the element could be added before the timeout, false
otherwiseInterruptedException
- if interrupted while waitingpublic void putWithTimeout(E element, long timeoutMillis) throws InterruptedException, TimeoutException
element
into the queue, waiting up to timeoutMillis
milliseconds if necessary. If
no element could be added, a TimeoutException
is thrown.element
- the element of type <E>
to put to the queuetimeoutMillis
- the time to wait in millisecondsInterruptedException
- if interrupted while waitingTimeoutException
- if a timeout occurred while waitingpublic E get() throws InterruptedException
<E>
InterruptedException
- if interrupted while waitingpublic E get(long timeoutMillis) throws InterruptedException
timeoutMillis
milliseconds if necessary. If no
element could be retrieved, null
is returned.timeoutMillis
- the time to wait in milliseconds<E>
, or null
if no element could be retrieved in timeoutMillis
millisecondsInterruptedException
- if interrupted while waitingpublic E getWithTimeout(long timeoutMillis) throws InterruptedException, TimeoutException
timeoutMillis
milliseconds if necessary. If no
element could be retrieved, a TimeoutException
is thrown.timeoutMillis
- the time to wait in milliseconds<E>
InterruptedException
- if interrupted while waitingTimeoutException
- if a timeout occurred while waitingprotected BlockingQueue<E> getBlockingQueue()
Copyright © 2011–2019 aiticon GmbH. All rights reserved.