changeset 219:a49f57481f14

CUSTOM executor for the corner cases where you need the custom thread factory and/or custom threads.
author shade
date Sun, 03 Nov 2013 13:29:40 +0400
parents c9aaa83494f4
children e56f65c57d68
files jmh-core/src/main/java/org/openjdk/jmh/runner/BaseMicroBenchmarkHandler.java
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/BaseMicroBenchmarkHandler.java	Wed Oct 30 20:57:52 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/BaseMicroBenchmarkHandler.java	Sun Nov 03 13:29:40 2013 +0400
@@ -150,7 +150,22 @@
                 return true;
             }
 
-        };
+        },
+
+        CUSTOM {
+            @Override
+            ExecutorService createExecutor(int maxThreads, String prefix) {
+                try {
+                    String className = System.getProperty("harness.executor.class");
+                    return (ExecutorService) Class.forName(className).getConstructor(int.class, String.class)
+                            .newInstance(maxThreads, prefix);
+                } catch (Exception e) {
+                    throw new IllegalStateException(e);
+                }
+            }
+        },
+
+        ;
 
         abstract ExecutorService createExecutor(int maxThreads, String prefix);