public class DistributedQueue extends Object
Modifier and Type | Class and Description |
---|---|
static class |
DistributedQueue.QueueEvent |
Constructor and Description |
---|
DistributedQueue(SolrZkClient zookeeper,
String dir) |
DistributedQueue(SolrZkClient zookeeper,
String dir,
Overseer.Stats stats) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsTaskWithRequestId(String requestIdKey,
String requestId)
Returns true if the queue contains a task with the specified async id.
|
Overseer.Stats |
getStats() |
String |
getTailId()
Gets last element of the Queue without removing it.
|
boolean |
offer(byte[] data)
Inserts data into queue.
|
DistributedQueue.QueueEvent |
offer(byte[] data,
long timeout)
Offer the data and wait for the response
|
byte[] |
peek()
Returns the data at the first element of the queue, or null if the queue is
empty.
|
DistributedQueue.QueueEvent |
peek(boolean block)
Returns the data at the first element of the queue, or null if the queue is
empty and block is false.
|
DistributedQueue.QueueEvent |
peek(long wait)
Returns the data at the first element of the queue, or null if the queue is
empty after wait ms.
|
List<DistributedQueue.QueueEvent> |
peekTopN(int n,
Set<String> excludeSet,
Long wait) |
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.
|
byte[] |
remove(DistributedQueue.QueueEvent event)
Remove the event and save the response into the other path.
|
byte[] |
take()
Removes the head of the queue and returns it, blocks until it succeeds.
|
public DistributedQueue(SolrZkClient zookeeper, String dir)
public DistributedQueue(SolrZkClient zookeeper, String dir, Overseer.Stats stats)
public boolean containsTaskWithRequestId(String requestIdKey, String requestId) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public byte[] remove() throws NoSuchElementException, org.apache.zookeeper.KeeperException, InterruptedException
NoSuchElementException
org.apache.zookeeper.KeeperException
InterruptedException
public byte[] remove(DistributedQueue.QueueEvent event) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public byte[] take() throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public boolean offer(byte[] data) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public DistributedQueue.QueueEvent offer(byte[] data, long timeout) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public byte[] peek() throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public List<DistributedQueue.QueueEvent> peekTopN(int n, Set<String> excludeSet, Long wait) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public String getTailId() throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public DistributedQueue.QueueEvent peek(boolean block) throws org.apache.zookeeper.KeeperException, InterruptedException
block
- if true, blocks until an element enters the queueorg.apache.zookeeper.KeeperException
InterruptedException
public DistributedQueue.QueueEvent peek(long wait) throws org.apache.zookeeper.KeeperException, InterruptedException
wait
- max wait time in ms.org.apache.zookeeper.KeeperException
InterruptedException
public byte[] poll() throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public Overseer.Stats getStats()
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.