On Wed, 20 Aug 2025 20:16:46 GMT, Roger Riggs <rri...@openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/Process.java line 652:
>> 
>>> 650:      */
>>> 651:     public void close() throws IOException {
>>> 652:         synchronized(this) {
>> 
>> Might be safer to create a dedicated, private object to use for locking here 
>> instead of `this`. Otherwise there's a possibility of deadlock (or 
>> indefinite delay), for example, if a subclass happens to have a 
>> `synchronized` method that could block while trying to communicate with the 
>> process, etc.
>
> There are other `synchronized(this)` within Process, its cleaner to stay 
> consistent and update them later in a separate PR.

That would be an incompatible change as subclasses could no longer define 
operations that are atomic with respect to the superclass methods that lock 
`this`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26649#discussion_r2289652539

Reply via email to