public class ZkDistributedQueue extends Object implements DistributedQueue
| Constructor and Description |
|---|
ZkDistributedQueue(SolrZkClient zookeeper,
String dir) |
ZkDistributedQueue(SolrZkClient zookeeper,
String dir,
Stats stats) |
ZkDistributedQueue(SolrZkClient zookeeper,
String dir,
Stats stats,
int maxQueueSize) |
ZkDistributedQueue(SolrZkClient zookeeper,
String dir,
Stats stats,
int maxQueueSize,
ConnectionManager.IsClosed higherLevelIsClosed) |
| Modifier and Type | Method and Description |
|---|---|
Map<String,Object> |
getStats() |
Stats |
getZkStats() |
void |
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[] |
peek(boolean block)
Returns the data at the first element of the queue, or null if the queue is
empty and block is false.
|
byte[] |
peek(long wait)
Returns the data at the first element of the queue, or null if the queue is
empty after wait ms.
|
Collection<Pair<String,byte[]>> |
peekElements(int max,
long waitMillis,
Predicate<String> acceptFilter)
Return the currently-known set of elements, using child names from memory.
|
byte[] |
poll()
Attempts to remove the head of the queue and return it.
|
byte[] |
remove()
Attempts to remove the head of the queue and return it.
|
void |
remove(Collection<String> paths) |
byte[] |
take()
Removes the head of the queue and returns it, blocks until it succeeds.
|
public ZkDistributedQueue(SolrZkClient zookeeper, String dir)
public ZkDistributedQueue(SolrZkClient zookeeper, String dir, Stats stats)
public ZkDistributedQueue(SolrZkClient zookeeper, String dir, Stats stats, int maxQueueSize)
public ZkDistributedQueue(SolrZkClient zookeeper, String dir, Stats stats, int maxQueueSize, ConnectionManager.IsClosed higherLevelIsClosed)
public byte[] peek()
throws org.apache.zookeeper.KeeperException,
InterruptedException
peek in interface DistributedQueueorg.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic byte[] peek(boolean block)
throws org.apache.zookeeper.KeeperException,
InterruptedException
peek in interface DistributedQueueblock - if true, blocks until an element enters the queueorg.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic byte[] peek(long wait)
throws org.apache.zookeeper.KeeperException,
InterruptedException
peek in interface DistributedQueuewait - max wait time in ms.org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic byte[] poll()
throws org.apache.zookeeper.KeeperException,
InterruptedException
poll in interface DistributedQueueorg.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic byte[] remove()
throws NoSuchElementException,
org.apache.zookeeper.KeeperException,
InterruptedException
remove in interface DistributedQueueNoSuchElementExceptionorg.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void remove(Collection<String> paths) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic byte[] take()
throws org.apache.zookeeper.KeeperException,
InterruptedException
take in interface DistributedQueueorg.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void offer(byte[] data)
throws org.apache.zookeeper.KeeperException,
InterruptedException
offer in interface DistributedQueueorg.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic Stats getZkStats()
public Map<String,Object> getStats()
getStats in interface DistributedQueuepublic Collection<Pair<String,byte[]>> peekElements(int max, long waitMillis, Predicate<String> acceptFilter) throws org.apache.zookeeper.KeeperException, InterruptedException
acceptFilter, waits up to waitMillis for at least one child to become available.
Package-private to support OverseerTaskQueue specifically.
peekElements in interface DistributedQueueorg.apache.zookeeper.KeeperExceptionInterruptedExceptionCopyright © 2000-2020 Apache Software Foundation. All Rights Reserved.