How do I shut everything down?

Aleksey Shipilev shade at redhat.com
Wed Oct 26 09:06:50 UTC 2016


Hi Bruce,

So, our project page says this:

"Make sure you tried these things before getting support:

Archetypes provide the golden build configuration. Try to generate the
clean JMH benchmark project and transplant the benchmark there. This is
important to try when upgrading to the newer JMH versions, since the
minute differences in the build configurations may attribute to the
failures you are seeing."

...and you are using a 3rd party jmh-gradle-plugin.

But if you copy e.g. Lists benchmark into the clean JMH
archetype-bootstrapped project, then you will see how -foe works with
either System.exit() or throwing the exceptions. Therefore, the fault is
somewhere in jmh-gradle-plugin, you might want to ask plugin maintainers
what's up.

Thanks,
-Aleksey


On 10/25/2016 06:02 PM, Bruce Eckel wrote:
> This is my gradle jmh section:
> 
>     jmh {
>         jmhVersion = '1.15'
>         duplicateClassesStrategy = 'warn'
>         failOnError = true
>         // See https://github.com/melix/jmh-gradle-plugin
>         // for other options
>     }
> 
> 
> However, that doesn't seem to have any effect: exceptions are reported
> as before but JMH just continues, as it did without the failOnError = true.
> 
> 
> -- Bruce Eckel
> www.MindviewInc.com <http://www.mindviewinc.com/>
> Blog: BruceEckel.github.io <http://BruceEckel.github.io>
> www.WinterTechForum.com <http://www.WinterTechForum.com>
> www.AtomicScala.com <http://www.AtomicScala.com>
> www.Reinventing-Business.com <http://www.Reinventing-Business.com>
> http://www.TrustOrganizations.com <http://www.ScalaSummit.com>
> 
> 
> On Mon, Oct 24, 2016 at 3:23 AM, Aleksey Shipilev <shade at redhat.com
> <mailto:shade at redhat.com>> wrote:
> 
>     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