Class DistributedWorkQueue
- java.lang.Object
-
- org.apache.accumulo.server.zookeeper.DistributedWorkQueue
-
public class DistributedWorkQueue extends Object
Provides a way to push work out to tablet servers via zookeeper and wait for that work to be done. Any tablet server can pick up a work item and process it. Worker processes watch a zookeeper node for tasks to be performed. After getting an exclusive lock on the node, the worker will perform the task.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
DistributedWorkQueue.Processor
-
Constructor Summary
Constructors Constructor Description DistributedWorkQueue(String path, AccumuloConfiguration config, ServerContext context)
DistributedWorkQueue(String path, AccumuloConfiguration config, ServerContext context, long timerInitialDelay, long timerPeriod)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addWork(String workId, byte[] data)
void
addWork(String workId, String data)
Adds work to the queue, automatically converting the String to bytes using UTF-8ServerContext
getContext()
List<String>
getWorkQueued()
void
startProcessing(DistributedWorkQueue.Processor processor, ThreadPoolExecutor executorService)
void
waitUntilDone(Set<String> workIDs)
-
-
-
Constructor Detail
-
DistributedWorkQueue
public DistributedWorkQueue(String path, AccumuloConfiguration config, ServerContext context)
-
DistributedWorkQueue
public DistributedWorkQueue(String path, AccumuloConfiguration config, ServerContext context, long timerInitialDelay, long timerPeriod)
-
-
Method Detail
-
getContext
public ServerContext getContext()
-
startProcessing
public void startProcessing(DistributedWorkQueue.Processor processor, ThreadPoolExecutor executorService) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
addWork
public void addWork(String workId, String data) throws org.apache.zookeeper.KeeperException, InterruptedException
Adds work to the queue, automatically converting the String to bytes using UTF-8- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
addWork
public void addWork(String workId, byte[] data) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
getWorkQueued
public List<String> getWorkQueued() throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
waitUntilDone
public void waitUntilDone(Set<String> workIDs) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
-