public class ThreadedWorkerManager extends Object implements WorkerManager, Interruptible
Constructor and Description |
---|
ThreadedWorkerManager(ExecutorService executor)
Constructs a threaded worker manager with a specified executor.
|
ThreadedWorkerManager(int numThreads)
Constructs a fix thread worker with a specified number of threads.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
Worker |
getWorker()
Get the result collector in use.
|
void |
interruptAndClose()
Interrupt a thread and then close it.
|
public ThreadedWorkerManager(int numThreads)
numThreads
- Number of threadspublic ThreadedWorkerManager(ExecutorService executor)
executor
- An executor servicepublic final Worker getWorker()
WorkerManager
getWorker
in interface WorkerManager
public final void interruptAndClose() throws InterruptedException
Interruptible
interruptAndClose
in interface Interruptible
InterruptedException
public final void close() throws InterruptedException
close
in interface AutoCloseable
InterruptedException
Copyright © 2018. All rights reserved.