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 Details

    • nbThreads

      protected final short nbThreads
    • threadPool

      protected ExecutorService threadPool
    • supplyThreadPool

      protected ExecutorService supplyThreadPool
  • Constructor Details

    • AbstractCallablePool

      public AbstractCallablePool(short nbThreads)
  • Method Details

    • 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()
    • afterCall

      protected abstract void afterCall(List<T> ret)
    • 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 interface AutoCloseable