Package org.apache.solr.cloud
Class OverseerTaskQueue
- java.lang.Object
-
- org.apache.solr.cloud.ZkDistributedQueue
-
- org.apache.solr.cloud.OverseerTaskQueue
-
- All Implemented Interfaces:
org.apache.solr.client.solrj.cloud.DistributedQueue
public class OverseerTaskQueue extends ZkDistributedQueue
AZkDistributedQueue
augmented with helper methods specific to the overseer task queues. Methods specific to this subclass ignore superclass internal state and hit ZK directly. This is inefficient! But the API on this class is kind of muddy..
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OverseerTaskQueue.QueueEvent
-
Constructor Summary
Constructors Constructor Description OverseerTaskQueue(org.apache.solr.common.cloud.SolrZkClient zookeeper, String dir)
OverseerTaskQueue(org.apache.solr.common.cloud.SolrZkClient zookeeper, String dir, Stats stats)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
allowOverseerPendingTasksToComplete()
boolean
containsTaskWithRequestId(String requestIdKey, String requestId)
Returns true if the queue contains a task with the specified async id.String
getTailId()
Gets last element of the Queue without removing it.OverseerTaskQueue.QueueEvent
offer(byte[] data, long timeout)
Offer the data and wait for the responseList<OverseerTaskQueue.QueueEvent>
peekTopN(int n, Predicate<String> excludeSet, long waitMillis)
void
remove(OverseerTaskQueue.QueueEvent event, boolean setResult)
Remove the event and save the response into the other path.-
Methods inherited from class org.apache.solr.cloud.ZkDistributedQueue
getStats, getZkStats, offer, peek, peek, peek, peekElements, poll, remove, remove, take
-
-
-
-
Method Detail
-
allowOverseerPendingTasksToComplete
public void allowOverseerPendingTasksToComplete()
-
containsTaskWithRequestId
public boolean containsTaskWithRequestId(String requestIdKey, String requestId) throws org.apache.zookeeper.KeeperException, InterruptedException
Returns true if the queue contains a task with the specified async id.- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
remove
public void remove(OverseerTaskQueue.QueueEvent event, boolean setResult) throws org.apache.zookeeper.KeeperException, InterruptedException
Remove the event and save the response into the other path.The response node should be updated only for a synchronous command, where the request node was created with specialized
offer(byte[], long)
, that also created the response node. For an asynchronous command, the request node was created with standardZkDistributedQueue.offer(byte[])
method, which does not create the response node. For such commands, the result is stored usingDistributedMap
instances.- Parameters:
setResult
- Whether we set data into the result node (true for synchronous commands).- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
offer
public OverseerTaskQueue.QueueEvent offer(byte[] data, long timeout) throws org.apache.zookeeper.KeeperException, InterruptedException
Offer the data and wait for the response- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
peekTopN
public List<OverseerTaskQueue.QueueEvent> peekTopN(int n, Predicate<String> excludeSet, long waitMillis) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
getTailId
public String getTailId() throws org.apache.zookeeper.KeeperException, InterruptedException
Gets last element of the Queue without removing it.- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
-