Package de.learnlib.oracle.parallelism
Class AbstractDynamicBatchProcessor<Q,P extends BatchProcessor<Q>>
- java.lang.Object
-
- de.learnlib.oracle.parallelism.AbstractDynamicBatchProcessor<Q,P>
-
- Type Parameters:
Q
- query typeP
- (sub-) processor type
- All Implemented Interfaces:
BatchProcessor<Q>
,ThreadPool
- Direct Known Subclasses:
DynamicParallelAdaptiveOracle
,DynamicParallelOmegaOracle
,DynamicParallelOracle
public abstract class AbstractDynamicBatchProcessor<Q,P extends BatchProcessor<Q>> extends Object implements ThreadPool, BatchProcessor<Q>
A batch processor that dynamically distributes queries to worker threads.An incoming set of queries is split into batches of the given size. The number of batches may exceed the available threads so that they are dynamically scheduled once a job finishes.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface de.learnlib.oracle.ThreadPool
ThreadPool.PoolPolicy
-
-
Constructor Summary
Constructors Constructor Description AbstractDynamicBatchProcessor(Supplier<? extends P> oracleSupplier, @org.checkerframework.checker.index.qual.NonNegative int batchSize, ExecutorService executor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected P
getProcessor()
void
processBatch(Collection<? extends Q> queries)
Process the batch.void
shutdown()
Shuts down all worker threads, but waits for any queued queries to be processed.void
shutdownNow()
Shuts down all worker threads, and attempts to abort any query processing currently taking place.
-
-
-
Constructor Detail
-
AbstractDynamicBatchProcessor
public AbstractDynamicBatchProcessor(Supplier<? extends P> oracleSupplier, @org.checkerframework.checker.index.qual.NonNegative int batchSize, ExecutorService executor)
-
-
Method Detail
-
shutdown
public void shutdown()
Description copied from interface:ThreadPool
Shuts down all worker threads, but waits for any queued queries to be processed.- Specified by:
shutdown
in interfaceThreadPool
- See Also:
ExecutorService.shutdown()
-
shutdownNow
public void shutdownNow()
Description copied from interface:ThreadPool
Shuts down all worker threads, and attempts to abort any query processing currently taking place.- Specified by:
shutdownNow
in interfaceThreadPool
- See Also:
ExecutorService.shutdownNow()
-
processBatch
public void processBatch(Collection<? extends Q> queries)
Description copied from interface:BatchProcessor
Process the batch.- Specified by:
processBatch
in interfaceBatchProcessor<Q>
- Parameters:
queries
- the batch to process
-
getProcessor
protected P getProcessor()
-
-