Class MonitoredSequentialExecutor<T>

Object
MonitoredSequentialExecutor<T>
Type Parameters:
T - inputType

public class MonitoredSequentialExecutor<T> extends Object
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 Details

    • MonitoredSequentialExecutor

      public MonitoredSequentialExecutor(Predicate<T> execFunc, Function<T,String> dscrFunc, Optional<MessageLogger> logger, boolean showHashSeperators)
      Creates a new MonitoredSequentialExecutor instance.
      Parameters:
      execFunc - executes a particular input (String)
      dscrFunc - extracts a string-description from an input
      logger - 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

      public TaskStatistics executeEachWithMonitor(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.
      Parameters:
      logPrefix - prefixed to the output of each log-message
      inputs - a collection of strings that uniquely determine each input
      Returns:
      statistics about the success/failure/execution-time etc. of applying the task to inputs.