Class MonitoredSequentialExecutor<T>
Object
MonitoredSequentialExecutor<T>
- Type Parameters:
T
- inputType
Runs executes sequence of jobs/tasks/whatever monitoring various pieces of information - how many
have run? - how many successful/failed? - how long did execution take? - etc.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionMonitoredSequentialExecutor
(Predicate<T> execFunc, Function<T, String> dscrFunc, Optional<MessageLogger> logger, boolean showHashSeperators) Creates a newMonitoredSequentialExecutor
instance. -
Method Summary
Modifier and TypeMethodDescriptionexecuteEachWithMonitor
(String logPrefix, List<T> inputs) Executes code for each element of inputs in serial, providing log-reports as to how many are finished, remain etc.
-
Constructor Details
-
MonitoredSequentialExecutor
public MonitoredSequentialExecutor(Predicate<T> execFunc, Function<T, String> dscrFunc, Optional<MessageLogger> logger, boolean showHashSeperators) Creates a newMonitoredSequentialExecutor
instance.- Parameters:
execFunc
- executes a particular input (String)dscrFunc
- extracts a string-description from an inputlogger
- reports before and after an input on the current status (disabled if empty())showHashSeperators
- indicates if lines of hashes should be placed before and after each log message (adds emphasis)
-
-
Method Details
-
executeEachWithMonitor
Executes code for each element of inputs in serial, providing log-reports as to how many are finished, remain etc.- Parameters:
logPrefix
- prefixed to the output of each log-messageinputs
- a collection of strings that uniquely determine each input- Returns:
- statistics about the success/failure/execution-time etc. of applying the task to inputs.
-