Package de.learnlib.oracle.parallelism
Class AbstractDynamicBatchProcessorBuilder<Q,P extends BatchProcessor<Q>,OR>
- java.lang.Object
-
- de.learnlib.oracle.parallelism.AbstractDynamicBatchProcessorBuilder<Q,P,OR>
-
- Type Parameters:
Q
- query typeP
- (sub-) processor typeOR
- constructed oracle type
- Direct Known Subclasses:
DynamicParallelAdaptiveOracleBuilder
,DynamicParallelOmegaOracleBuilder
,DynamicParallelOracleBuilder
public abstract class AbstractDynamicBatchProcessorBuilder<Q,P extends BatchProcessor<Q>,OR> extends Object
Builder class for aAbstractDynamicBatchProcessor
.
-
-
Constructor Summary
Constructors Constructor Description AbstractDynamicBatchProcessorBuilder(Collection<? extends P> oracles)
AbstractDynamicBatchProcessorBuilder(Supplier<? extends P> oracleSupplier)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract OR
buildOracle(Supplier<? extends P> supplier, int batchSize, ExecutorService executorService)
OR
create()
Create the batch processor.AbstractDynamicBatchProcessorBuilder<Q,P,OR>
withBatchSize(int batchSize)
Sets the size of batches that are submitted.AbstractDynamicBatchProcessorBuilder<Q,P,OR>
withCustomExecutor(ExecutorService executor)
Sets the executor service to use for submitting batches.AbstractDynamicBatchProcessorBuilder<Q,P,OR>
withPoolPolicy(ThreadPool.PoolPolicy policy)
Sets the pool policy in case the builder creates its own executor for processing batches.AbstractDynamicBatchProcessorBuilder<Q,P,OR>
withPoolSize(@org.checkerframework.checker.index.qual.NonNegative int poolSize)
Sets the number of instances that should process batches.
-
-
-
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
-
withPoolPolicy
public AbstractDynamicBatchProcessorBuilder<Q,P,OR> withPoolPolicy(ThreadPool.PoolPolicy policy)
Sets the pool policy in case the builder creates its own executor for processing batches.- Parameters:
policy
- the policy- 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)
-
-