Class ScenariosExecutor


  • public class ScenariosExecutor
    extends java.lang.Object
    • Constructor Detail

      • ScenariosExecutor

        public ScenariosExecutor​(java.lang.String name)
      • ScenariosExecutor

        public ScenariosExecutor​(java.lang.String name,
                                 int threads)
    • Method Detail

      • execute

        public void execute​(Scenario scenario)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • awaitAllResults

        public ScenariosResults awaitAllResults()
        Shuts down all running scenarios and awaits all results.
        Returns:
        the final scenario-result map.
      • awaitAllResults

        public ScenariosResults awaitAllResults​(long timeout,
                                                long updateInterval)
        Shuts down all running scenarios and awaits all results.
        Parameters:
        timeout - how long to wait for the results to complete
        updateInterval - how frequently to log status while waiting
        Returns:
        the final scenario-result map
      • getPendingScenarios

        public java.util.List<java.lang.String> getPendingScenarios()
        Returns:
        list of scenarios which have been submitted, in order
      • getAsyncResultStatus

        public java.util.Map<Scenario,​java.util.Optional<ScenarioResult>> getAsyncResultStatus()

        Returns a map of all pending scenario names and optional results. All submitted scenarios are included. Those which are still pending are returned with an empty option.

        Results may be exceptional. If ScenarioResult.getException() is present, then the result did not complete normally.

        Returns:
        map of async results, with incomplete results as Optional.empty()
      • getPendingScenario

        public java.util.Optional<Scenario> getPendingScenario​(java.lang.String scenarioName)
      • getPendingResult

        public java.util.Optional<ScenarioResult> getPendingResult​(java.lang.String scenarioName)
        Get the result of a pending or completed scenario. If the scenario has run to completion, then the Optional will be present. If the scenario threw an exception, or there was an error accessing the future, then the result will contain the exception. If the callable for the scenario was cancelled, then the result will contain an exception stating such.

        If the scenario is still pending, then the optional will be empty.

        Parameters:
        scenarioName - the scenario name of interest
        Returns:
        an optional result
      • cancelScenario

        public void cancelScenario​(java.lang.String scenarioName)
      • getName

        public java.lang.String getName()
      • notifyException

        public void notifyException​(java.lang.Thread t,
                                    java.lang.Throwable e)