How do I shut everything down?
Aleksey Shipilev
shade at redhat.com
Mon Oct 24 10:23:21 UTC 2016
On 10/22/2016 08:59 PM, Bruce Eckel wrote:
> If I call System.exit(), it prints a message about early JVM shutdown but
> then keeps going. Is there a call I can make to terminate everything? I'd
> like to be able to report a runtime error and then quit so it doesn't
> scroll off the screen. Thanks!
The default JMH policy is to handle the test failure gracefully, and
move on: this helps a lot when running large suites of tests. This can
be overriden, you can request harness to fail on benchmark error with
-foe ("fail on error" cmdline switch) or the similar OptionsBuilder method.
Thanks,
-Aleksey
P.S. Don't ever use System.exit() in the code driven by any framework.
In JMH, you can throw the exception out of @Benchmark/@Setup/@TearDown
to terminate the workload.
More information about the jmh-dev
mailing list