Patch: Clarify the requirements on Profiler constructors

Dmitry Timofeev dmitry.timofeiev at gmail.com
Fri Oct 11 11:50:04 UTC 2019


# HG changeset patch
# User Dmitry Timofeev <dmitry.timofeiev at gmail.com>
# Date 1570794166 -10800
#      Fri Oct 11 14:42:46 2019 +0300
# Node ID 943e1143f1871a60c0fa82a07ca57b8bd690c5a7
# Parent  99d7b73cf1e355341e835208f95447cc5617481d
Clarify that 3rd-party profilers must have a no-arg ctor:

Clarify that 3rd-party Profiler implementations must have
a no-arg ctor in order to be discovered by the ServiceLoader.

diff -r 99d7b73cf1e3 -r 943e1143f187
jmh-core/src/main/java/org/openjdk/jmh/profile/Profiler.java
--- a/jmh-core/src/main/java/org/openjdk/jmh/profile/Profiler.java
Fri May 17 10:44:26 2019 -0700
+++ b/jmh-core/src/main/java/org/openjdk/jmh/profile/Profiler.java
Fri Oct 11 14:42:46 2019 +0300
@@ -36,6 +36,13 @@
  * The message in {@link org.openjdk.jmh.profile.ProfilerException} should
  * clearly articulate the reason.
  *
+ * <p>JMH will discover profiler implementations using the SPI mechanism.
+ * Please note that discoverable implementations <em>must</em> provide
+ * a no-arg constructor for initial discovery; the instance created
+ * during discovery will be rejected. If they also have a constructor
+ * accepting the option line, it would be preferred for subsequent
+ * instantiation over the no-arg constructor.
+ *
  * <p>Profilers normally implement one of the subinterfaces.</p>
  * @see org.openjdk.jmh.profile.ExternalProfiler
  * @see org.openjdk.jmh.profile.InternalProfiler

-- 
Best wishes,
Dmitry Timofeev


More information about the jmh-dev mailing list