On Tue, 19 May 2026 11:38:51 GMT, Kevin Walls <[email protected]> wrote:

> Yes I was avoiding writing a new AttachProvider. It would mean the precedence 
> of filename and PID might be set by iteration order of the Providers.

If someone renames a core file to 123 and there is a process 123 also running 
then `jcmd 123 Thread.print` is ambiguous. How does putting both implementation 
into one AttachProvider help this?

> This was to avoid a surprise behaviour change at the API level. Changing the 
> existing attach method that only takes a PID, to possibly accept a filename, 
> introduces a possible problem where they expect to attach to PID 123 but a 
> file "123" exists.
> 
> A new method is free to prefer a file if it exists, without a conflict.

I think we should try to have the additions to the API to look like they were 
in the API from the start (when we added it in JDK 6). Right now the overloads 
are a bit problematic, hence the points in the previous comment.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/31011#issuecomment-4487777954
PR Comment: https://git.openjdk.org/jdk/pull/31011#issuecomment-4487794019

Reply via email to