Class AbstractDynamicBatchProcessorBuilder<Q,​P extends BatchProcessor<Q>,​OR>

    • Constructor Detail

      • AbstractDynamicBatchProcessorBuilder

        public AbstractDynamicBatchProcessorBuilder​(Supplier<? extends P> oracleSupplier)
      • AbstractDynamicBatchProcessorBuilder

        public AbstractDynamicBatchProcessorBuilder​(Collection<? extends P> oracles)
    • Method Detail

      • withBatchSize

        public AbstractDynamicBatchProcessorBuilder<Q,​P,​OR> withBatchSize​(int batchSize)
        Sets the size of batches that are submitted.
        Parameters:
        batchSize - the minimal size of batches
        Returns:
        this
      • withCustomExecutor

        public AbstractDynamicBatchProcessorBuilder<Q,​P,​OR> withCustomExecutor​(ExecutorService executor)
        Sets the executor service to use for submitting batches. Note that if the builder is initialized with a collection of processors, an exception may be thrown if the thread pool tries to spawn more threads than oracles are available.
        Parameters:
        executor - the executor to use
        Returns:
        this
      • withPoolSize

        public AbstractDynamicBatchProcessorBuilder<Q,​P,​OR> withPoolSize​(@org.checkerframework.checker.index.qual.NonNegative int poolSize)
        Sets the number of instances that should process batches. Note that this value is ignored if the builder has been initialized with a collection of processors in order to guarantee that no unavailable resources are accessed.
        Parameters:
        poolSize - the number of instances to delegate batches to
        Returns:
        this
      • create

        public OR create()
        Create the batch processor.
        Returns:
        the batch processor
      • buildOracle

        protected abstract OR buildOracle​(Supplier<? extends P> supplier,
                                          int batchSize,
                                          ExecutorService executorService)