|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.curator.framework.recipes.queue.DistributedIdQueue<T>
public class DistributedIdQueue<T>
A version of DistributedQueue that allows IDs to be associated with queue items. Items
can then be removed from the queue if needed
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public void start()
throws Exception
QueueBase
start in interface QueueBase<T>Exception - startup errors
public void close()
throws IOException
close in interface CloseableIOExceptionpublic org.apache.curator.framework.listen.ListenerContainer<QueuePutListener<T>> getPutListenerContainer()
QueueBase
getPutListenerContainer in interface QueueBase<T>public void setErrorMode(ErrorMode newErrorMode)
QueueBaseQueueBuilder.lockPath(String). Determines
the behavior when the queue consumer throws an exception
setErrorMode in interface QueueBase<T>newErrorMode - the new error mode (the default is ErrorMode.REQUEUE
public boolean flushPuts(long waitTime,
TimeUnit timeUnit)
throws InterruptedException
QueueBase
flushPuts in interface QueueBase<T>waitTime - max wait timetimeUnit - time unit
InterruptedException - if thread was interruptedpublic int getLastMessageCount()
QueueBase
getLastMessageCount 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 Id
Exception - errors
public 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 unit
Exception
public int remove(String id)
throws Exception
id - item Id to remove
Exception - errors
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||