Class RunHandle

java.lang.Object
org.acemq.workloads.RunHandle

public final class RunHandle extends Object
A run in progress.

Returned by Workload.start(String, RunListener), for anything that cannot sit and wait for Workload.run(String) to return: a user interface, a scheduler, a test that wants to stop a run once it has seen enough.

  • Method Details

    • workload

      public Workload workload()
      Returns:
      the workload being run
    • stop

      public void stop()
      Ends the run early and reports on what it measured.

      Not an abort. Publishers stop, consumers are given their usual moment to finish what is in flight, and a report is produced covering however long the measured phase actually lasted. That report is honest rather than empty — and a run stopped after twenty seconds trips the run-was-long-enough rule, which is exactly what should happen.

      Stopping during warm-up produces a report over an empty measured window. Calling this twice does nothing the second time.

    • isStopping

      public boolean isStopping()
      Returns:
      whether somebody has asked this run to stop
    • isRunning

      public boolean isRunning()
      Returns:
      whether the run is still going
    • report

      The report, when there is one.

      Completes exceptionally if the run could not be made: a broker that cannot be reached, a queue the broker refuses to declare. A run that was stopped early completes normally.

      Returns:
      a future for the report
    • toString

      public String toString()
      Overrides:
      toString in class Object