Package de.uni_kiel.rz.fdr.repl
Class REPLJobCallbackAutoTune
java.lang.Object
de.uni_kiel.rz.fdr.repl.REPLJobCallbackAutoTune
- All Implemented Interfaces:
Consumer<REPLJob.JobEvent>
A Callback that you can use for your jobs; it automatically adjusts its concurrency to tune it for maximum throughput.
-
Constructor Summary
ConstructorsConstructorDescriptionREPLJobCallbackAutoTune
(int minConcurrency, int maxConcurrency) Create a new AutoTune job callback. -
Method Summary
Modifier and TypeMethodDescriptionvoid
For internal use only.int
Get the current maximum concurrency limit.int
Get the current minimum concurrency limit.void
setMaxConcurrency
(int maxConcurrency) Set a new maximum concurrency limit.void
setMinConcurrency
(int minConcurrency) Set a new minimum concurrency limit.
-
Constructor Details
-
REPLJobCallbackAutoTune
public REPLJobCallbackAutoTune(int minConcurrency, int maxConcurrency) Create a new AutoTune job callback. Each instance should only be used once, with a single job.- Parameters:
minConcurrency
- The minimum concurrency level this callback will ever set.maxConcurrency
- The maximum concurrency level this callback will ever set.
-
-
Method Details
-
accept
For internal use only.- Specified by:
accept
in interfaceConsumer<REPLJob.JobEvent>
- Parameters:
ev
- A new job event.
-
getMinConcurrency
public int getMinConcurrency()Get the current minimum concurrency limit.- Returns:
- The current minimum concurrency limit.
-
setMinConcurrency
public void setMinConcurrency(int minConcurrency) Set a new minimum concurrency limit. Must be bigger than 0 and can not be greater then the maximum concurrency limit. You can safely invoke this method while the associated job is active.- Parameters:
minConcurrency
- The new minimum concurrency limit.
-
getMaxConcurrency
public int getMaxConcurrency()Get the current maximum concurrency limit.- Returns:
- The current maximum concurrency limit.
-
setMaxConcurrency
public void setMaxConcurrency(int maxConcurrency) Set a new maximum concurrency limit. Must not be smaller than the minimum concurrency limit. You can safely invoke this method while the associated job is active.- Parameters:
maxConcurrency
- The new maximum concurrency limit.
-