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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractCallablePool.NamedThreadFactory
-
Field Summary
Fields Modifier and Type Field Description protected short
nbThreads
protected ExecutorService
supplyThreadPool
protected ExecutorService
threadPool
-
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 void
afterCall(List<T> ret)
void
close()
protected abstract Callable<T>
getCallable(int i)
protected abstract T
getErrorStatus()
Value to return when there was an exception during executionint
getNbThreads()
protected abstract String
getThreadPrefix()
protected List<T>
runPool()
CompletableFuture<List<T>>
start()
-
-
-
Field Detail
-
nbThreads
protected final short nbThreads
-
threadPool
protected ExecutorService threadPool
-
supplyThreadPool
protected ExecutorService supplyThreadPool
-
-
Constructor Detail
-
AbstractCallablePool
public AbstractCallablePool(short nbThreads)
-
-
Method Detail
-
getErrorStatus
protected abstract T getErrorStatus()
Value to return when there was an exception during execution
-
getCallable
protected abstract Callable<T> getCallable(int i)
-
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:
close
in interfaceAutoCloseable
-
-