T - The work unit type.public class WorkQueue<T> extends Object implements AutoCloseable
| Modifier and Type | Class and Description |
|---|---|
static interface |
WorkQueue.WorkUnitProcessor<T>
A work unit processor.
|
| Constructor and Description |
|---|
WorkQueue(Collection<T> initialWorkUnits,
WorkQueue.WorkUnitProcessor<T> workUnitProcesor,
InterruptionChecker interruptionChecker,
LogNode log)
A parallel work queue.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addWorkUnits(Collection<T> workUnits)
Add multiple units of work.
|
void |
close()
Ensure that there are no work units still uncompleted.
|
void |
runWorkLoop()
Start a worker.
|
void |
startWorkers(ExecutorService executorService,
int numWorkers,
LogNode log)
Start worker threads with a shared log.
|
public WorkQueue(Collection<T> initialWorkUnits, WorkQueue.WorkUnitProcessor<T> workUnitProcesor, InterruptionChecker interruptionChecker, LogNode log)
public void startWorkers(ExecutorService executorService, int numWorkers, LogNode log)
public void runWorkLoop()
throws InterruptedException,
ExecutionException
public void addWorkUnits(Collection<T> workUnits)
public void close()
throws ExecutionException
close in interface AutoCloseableExecutionExceptionCopyright © 2016. All rights reserved.