Class AbstractCallablePool<T>
- java.lang.Object
-
- org.nuxeo.lib.stream.pattern.consumer.internals.AbstractCallablePool<T>
-
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
ConsumerPool,ProducerPool
public abstract class AbstractCallablePool<T> extends Object implements AutoCloseable
Execute a pool of callables.- Since:
- 9.1
-
-
Field Summary
Fields Modifier and Type Field Description protected shortnbThreadsprotected ExecutorServicesupplyThreadPoolprotected ExecutorServicethreadPool
-
Constructor Summary
Constructors Constructor Description AbstractCallablePool(short nbThreads)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidafterCall(List<T> ret)voidclose()protected abstract Callable<T>getCallable(int i)protected abstract TgetErrorStatus()Value to return when there was an exception during executionintgetNbThreads()protected abstract StringgetThreadPrefix()protected List<T>runPool()CompletableFuture<List<T>>start()
-
-
-
Field Detail
-
nbThreads
protected final short nbThreads
-
threadPool
protected ExecutorService threadPool
-
supplyThreadPool
protected ExecutorService supplyThreadPool
-
-
Method Detail
-
getErrorStatus
protected abstract T getErrorStatus()
Value to return when there was an exception during execution
-
getThreadPrefix
protected abstract String getThreadPrefix()
-
getNbThreads
public int getNbThreads()
-
start
public CompletableFuture<List<T>> start()
-
runPool
protected List<T> runPool() throws InterruptedException
- Throws:
InterruptedException
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
-