public class DistributedQueue extends Object
Constructor and Description |
---|
DistributedQueue(SolrZkClient zookeeper,
String dir) |
DistributedQueue(SolrZkClient zookeeper,
String dir,
Overseer.Stats stats) |
Modifier and Type | Method and Description |
---|---|
Overseer.Stats |
getStats() |
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.
|
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[] |
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 byte[] peek() throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public byte[] peek(boolean block) throws org.apache.zookeeper.KeeperException, InterruptedException
block
- if true, blocks until an element enters the queueorg.apache.zookeeper.KeeperException
InterruptedException
public byte[] 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 byte[] remove() throws NoSuchElementException, org.apache.zookeeper.KeeperException, InterruptedException
NoSuchElementException
org.apache.zookeeper.KeeperException
InterruptedException
public byte[] take() throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public void offer(byte[] data) throws org.apache.zookeeper.KeeperException, InterruptedException
poll()
to
return the offered element. Use a blocking method if you must wait for the offered
element to become visible.org.apache.zookeeper.KeeperException
InterruptedException
public Overseer.Stats getStats()
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.