JMH silently hangs if exception occurs in benchmark method

Sergej Zagurskiy s.zagurskiy at corp.mail.ru
Fri May 31 06:24:56 PDT 2013


 Good day!

I've written a benchmark that occasionally throws exception. It appeared that JMH silently hangs in this case.

Here is the code:

@State
public class MyBenchmark {
  private int i = 0;

  @GenerateMicroBenchmark
  public void benchmark() {
    if (++i > 1) {
      throw new RuntimeException();
    }
  }
}

Am I doing something wrong? Or is it a bug in JMH?
Thanks!

PS. Please CC me.

---
Zagurskiy Sergej
Lead Programmer
Game Development Division
Mail.ru Group
s.zagurskiy at corp.mail.ru

47 bldg 2, Leningradsky Prospekt
Moscow 125167 Russia
Phone: +7 495 780 9795
Cell.: +7 926 994 7443
Fax: +7 495 787 0541
http://www.mail.ru


More information about the jmh-dev mailing list