changeset 2:25baec641abb

Handle the exception in "one-shot" mode correctly. JMH hangs otherwise.
author shade
date Mon, 08 Apr 2013 16:13:35 +0400
parents 9e78b879b0a5
children c64b49e5c82c
files jmh-core/src/main/java/org/openjdk/jmh/runner/ShotMicroBenchmarkHandler.java
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/ShotMicroBenchmarkHandler.java	Thu Mar 28 19:53:06 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/ShotMicroBenchmarkHandler.java	Mon Apr 08 16:13:35 2013 +0400
@@ -165,8 +165,12 @@
         public Result call() throws Exception {
             try {
                 return invokeBenchmark(invocationHandler.get().getInstance());
-            } catch (Throwable t) {
-                throw new Exception(t);
+            } catch (Throwable e) {
+                // about to fail the iteration;
+                // compensate for missed sync-iteration latches, we don't care about that anymore
+                loop.preSetup();
+                loop.preTearDown();
+                throw new Exception(e); // wrapping Throwable
             }
         }