public class DistributedIdQueue<T> extends Object implements QueueBase<T>
DistributedQueue that allows IDs to be associated with queue items. Items
can then be removed from the queue if needed| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
flushPuts(long waitTime,
TimeUnit timeUnit)
Wait until any pending puts are committed
|
int |
getLastMessageCount()
Return the most recent message count from the queue.
|
org.apache.curator.framework.listen.ListenerContainer<QueuePutListener<T>> |
getPutListenerContainer()
Return the manager for put listeners
|
void |
put(T item,
String itemId)
Put an item into the queue with the given Id
NOTE: if an upper bound was set via QueueBuilder.maxItems, this method will
block until there is available space in the queue. |
boolean |
put(T item,
String itemId,
int maxWait,
TimeUnit unit)
Same as
put(Object, String) but allows a maximum wait time if an upper bound was set
via QueueBuilder.maxItems. |
int |
remove(String id)
Remove any items with the given Id
|
void |
setErrorMode(ErrorMode newErrorMode)
Used when the queue is created with a
QueueBuilder.lockPath(String). |
void |
start()
Start the queue.
|
public void start()
throws Exception
QueueBasepublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic org.apache.curator.framework.listen.ListenerContainer<QueuePutListener<T>> getPutListenerContainer()
QueueBasegetPutListenerContainer in interface QueueBase<T>public void setErrorMode(ErrorMode newErrorMode)
QueueBaseQueueBuilder.lockPath(String). Determines
the behavior when the queue consumer throws an exceptionsetErrorMode in interface QueueBase<T>newErrorMode - the new error mode (the default is ErrorMode.REQUEUEpublic boolean flushPuts(long waitTime,
TimeUnit timeUnit)
throws InterruptedException
QueueBaseflushPuts in interface QueueBase<T>waitTime - max wait timetimeUnit - time unitInterruptedException - if thread was interruptedpublic int getLastMessageCount()
QueueBasegetLastMessageCount in interface QueueBase<T>public void put(T item, String itemId) throws Exception
QueueBuilder.maxItems, this method will
block until there is available space in the queue.item - itemitemId - item IdException - errorspublic boolean put(T item, String itemId, int maxWait, TimeUnit unit) throws Exception
put(Object, String) but allows a maximum wait time if an upper bound was set
via QueueBuilder.maxItems.item - itemitemId - item IdmaxWait - maximum waitunit - wait unitExceptionCopyright © 2011–2018 The Apache Software Foundation. All rights reserved.