|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.curator.framework.recipes.queue.SimpleDistributedQueue
public class SimpleDistributedQueue
Drop in replacement for: org.apache.zookeeper.recipes.queue.DistributedQueue that is part of the ZooKeeper distribution
This class is data compatible with the ZK version. i.e. it uses the same naming scheme so it can read from an existing queue
| Constructor Summary | |
|---|---|
SimpleDistributedQueue(org.apache.curator.framework.CuratorFramework client,
String path)
|
|
| Method Summary | |
|---|---|
byte[] |
element()
Return the head of the queue without modifying the queue. |
boolean |
offer(byte[] data)
Inserts data into queue. |
byte[] |
peek()
Returns the data at the first element of the queue, or null if the queue is empty. |
byte[] |
poll()
Attempts to remove the head of the queue and return it. |
byte[] |
poll(long timeout,
TimeUnit unit)
Retrieves and removes the head of this queue, waiting up to the specified wait time if necessary for an element to become available. |
byte[] |
remove()
Attempts to remove the head of the queue and return it. |
byte[] |
take()
Removes the head of the queue and returns it, blocks until it succeeds. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleDistributedQueue(org.apache.curator.framework.CuratorFramework client,
String path)
client - the clientpath - path to store queue nodes| Method Detail |
|---|
public byte[] element()
throws Exception
Exception - errors
NoSuchElementException - if the queue is empty
public byte[] remove()
throws Exception
Exception - errors
NoSuchElementException - if the queue is empty
public byte[] take()
throws Exception
Exception - errors
public boolean offer(byte[] data)
throws Exception
data - the data
Exception - errors
public byte[] peek()
throws Exception
Exception - errors
public byte[] poll(long timeout,
TimeUnit unit)
throws Exception
timeout - how long to wait before giving up, in units of
unitunit - a TimeUnit determining how to interpret the
timeout parameter
Exception - errors
public byte[] poll()
throws Exception
Exception - errors
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||