Package de.learnlib.oracle.parallelism
Class AbstractStaticBatchProcessor<Q,P extends BatchProcessor<Q>>
- java.lang.Object
-
- de.learnlib.oracle.parallelism.AbstractStaticBatchProcessor<Q,P>
-
- Type Parameters:
Q
- query typeP
- (sub-) processor type
- All Implemented Interfaces:
BatchProcessor<Q>
,ThreadPool
- Direct Known Subclasses:
StaticParallelOmegaOracle
,StaticParallelOracle
public abstract class AbstractStaticBatchProcessor<Q,P extends BatchProcessor<Q>> extends Object implements ThreadPool, BatchProcessor<Q>
A batch processor that statically distributes a set of queries among several threads.An incoming set of queries is divided into a given number of batches, such that the sizes of all batches differ by at most one. This keeps the required synchronization effort low, but if some batches are "harder" (for whatever reason) than others, the load can be very unbalanced.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface de.learnlib.oracle.parallelism.ThreadPool
ThreadPool.PoolPolicy
-
-
Field Summary
Fields Modifier and Type Field Description static int
MIN_BATCH_SIZE
static int
NUM_INSTANCES
static ThreadPool.PoolPolicy
POOL_POLICY
-
Constructor Summary
Constructors Constructor Description AbstractStaticBatchProcessor(Collection<? extends P> oracles, @org.checkerframework.checker.index.qual.NonNegative int minBatchSize, ThreadPool.PoolPolicy policy)
-
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.
-
-
-
Field Detail
-
MIN_BATCH_SIZE
public static final int MIN_BATCH_SIZE
-
NUM_INSTANCES
public static final int NUM_INSTANCES
-
POOL_POLICY
public static final ThreadPool.PoolPolicy POOL_POLICY
-
-
Constructor Detail
-
AbstractStaticBatchProcessor
public AbstractStaticBatchProcessor(Collection<? extends P> oracles, @org.checkerframework.checker.index.qual.NonNegative int minBatchSize, ThreadPool.PoolPolicy policy)
-
-
Method Detail
-
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
-
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()
-
getProcessor
protected P getProcessor()
-
-