RFR: Runner: if -Djmh.ignoreLock=true then skip jmh.lock creation
Aleksey Shipilev
shade at openjdk.java.net
Wed Oct 21 08:29:36 UTC 2020
On Wed, 21 Oct 2020 08:18:29 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> When -Djmh.ignoreLock=true JMH anyway will try to create the jmh.lock file and if it fails it will write a warning for
>> an user. This may be not a best way for several reasons:
>> 1. If user specified ignoreLock then he already knows what she or he doing.
>> 2. If the Benchmark is started from IDE i.e idea-jmh-plugin and the ignoreLock was added automatically then users may
>> be confused by this warning 3. It makes execution slightly longer when we anyway trying to create the jmh.lock file
>> 4. This simplifies logic
>
> jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java line 212:
>
>> 210: } catch (IOException e) {
>> 211: String msg = "Exception while trying to acquire the JMH lock (" + JMH_LOCK_FILE + "): " +
>> e.getMessage(); 212: throw new RunnerException("ERROR: " + msg + ", exiting. Use -Djmh.ignoreLock=true to
>> forcefully continue.");
>
> Similarly, `throw new RunnerException("ERROR: Exception while trying to acquire the JMH lock (" + JMH_LOCK_FILE + "),
> exiting. Use -Djmh.ignoreLock=true to forcefully continue.", e);`
Note the change above also links in the `IOException` as the cause.
-------------
PR: https://git.openjdk.java.net/jmh/pull/6
More information about the jmh-dev
mailing list