Question on jmh.lock
Aleksey Shipilev
aleksey.shipilev at oracle.com
Tue Jan 12 18:46:53 UTC 2016
Hi,
It's unclear if you actually run into the problem with this mechanism?
On 01/12/2016 08:55 PM, Alun Evans wrote:
> This java.io.tmp + jmh.lock doesn’t seemed to be deleted at the end
> of a test run, meaning that when a different user comes to run the
> test, the file already exists.
It's irrelevant that a file exists, what matters is that we are
java.nio.channels.FileLock-ing it. Note that this is different from
"file locking" that shell scripts do: write out the tombstone file, then
remove it at the end; plus always check for the existence of the
tombstone file on entry.
Therefore, it is irrelevant that jmh.lock file is kept after JMH exits.
If that was a problem, then consecutive JMH invocation by the same user
would not also work.
> I was debating setting `java.io.tmp` to something else, but I think
> that the goal is that only 1 user per machine should really be
> running a JMH test at the same time, so it’s probably just better to
> cleanup the lock file ?
The intent was to disallow accidental JMH session when other session is
already running (think running JMH from the IDE). The side effect of
disallowing concurrent JMH runs on the entire machine is a nice special
case, and I think we should continue doing that.
Thanks,
-Aleksey
More information about the jmh-dev
mailing list