public class BlockingQueueSnmpCompletionService<V> extends Object implements SnmpCompletionService<V>
SnmpCompletionService
that is backed by a BlockingQueue
.Constructor and Description |
---|
BlockingQueueSnmpCompletionService()
Creates a new completion service backed by an unbounded blocking queue.
|
BlockingQueueSnmpCompletionService(BlockingQueue<SnmpEvent<V>> queue)
Creates a new completion service backed by the given blocking queue.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isIdle()
Tests whether this completion service has a remaining event that has
not yet been retrieved.
|
SnmpEvent<V> |
poll()
Gets an event representing a completed response if one is available.
|
SnmpEvent<V> |
poll(long timeout)
Gets a response event waiting as long as the specified duration for
one to become available.
|
void |
submit(SnmpOperation<V> operation)
Submits an operation to the service.
|
SnmpEvent<V> |
take()
Gets a completed response waiting until one becomes available.
|
public BlockingQueueSnmpCompletionService()
public BlockingQueueSnmpCompletionService(BlockingQueue<SnmpEvent<V>> queue)
queue
- queue that will be used to buffer received response datapublic boolean isIdle()
isIdle
in interface SnmpCompletionService<V>
true
if an incomplete response event remainspublic SnmpEvent<V> poll()
poll
in interface SnmpCompletionService<V>
null
if none is availablepublic SnmpEvent<V> poll(long timeout) throws InterruptedException
poll
in interface SnmpCompletionService<V>
timeout
- timeout in millisecondsnull
if one did not become available
within the specified time intervalInterruptedException
- if the calling thread is interrupted
while waitingpublic SnmpEvent<V> take() throws InterruptedException
take
in interface SnmpCompletionService<V>
InterruptedException
- if the calling thread is interrupted
while waitingpublic void submit(SnmpOperation<V> operation)
The operation is invoked asynchronously and its response is placed into the queue managed by this service. service.
submit
in interface SnmpCompletionService<V>
operation
- the operation to invokeCopyright © 2012–2015. All rights reserved.