com.netflix.curator.framework.recipes.queue
Interface QueueBase<T>

All Superinterfaces:
java.io.Closeable
All Known Implementing Classes:
DistributedDelayQueue, DistributedIdQueue, DistributedPriorityQueue, DistributedQueue

public interface QueueBase<T>
extends java.io.Closeable


Method Summary
 boolean flushPuts(long waitTime, java.util.concurrent.TimeUnit timeUnit)
          Wait until any pending puts are committed
 int getLastMessageCount()
          Return the most recent message count from the queue.
 com.netflix.curator.framework.listen.ListenerContainer<QueuePutListener<T>> getPutListenerContainer()
          Return the manager for put listeners
 void setErrorMode(ErrorMode newErrorMode)
          Used when the queue is created with a QueueBuilder.lockPath(String).
 void start()
          Start the queue.
 
Methods inherited from interface java.io.Closeable
close
 

Method Detail

start

void start()
           throws java.lang.Exception
Start the queue. No other methods work until this is called

Throws:
java.lang.Exception - startup errors

getPutListenerContainer

com.netflix.curator.framework.listen.ListenerContainer<QueuePutListener<T>> getPutListenerContainer()
Return the manager for put listeners

Returns:
put listener container

setErrorMode

void setErrorMode(ErrorMode newErrorMode)
Used when the queue is created with a QueueBuilder.lockPath(String). Determines the behavior when the queue consumer throws an exception

Parameters:
newErrorMode - the new error mode (the default is ErrorMode.REQUEUE

flushPuts

boolean flushPuts(long waitTime,
                  java.util.concurrent.TimeUnit timeUnit)
                  throws java.lang.InterruptedException
Wait until any pending puts are committed

Parameters:
waitTime - max wait time
timeUnit - time unit
Returns:
true if the flush was successful, false if it timed out first
Throws:
java.lang.InterruptedException - if thread was interrupted

getLastMessageCount

int getLastMessageCount()
Return the most recent message count from the queue. This is useful for debugging/information purposes only.

Returns:
count (can be 0)