On Thu, 21 Aug 2025 05:49:57 GMT, Alan Bateman <al...@openjdk.org> wrote:
>> Removing the locking breaks compatibility in the same way. You can argue the >> use of `synchronized(this)` is not specified anywhere, but people can become >> aware of it and depend on it. The CSR request would have to determine >> whether this is acceptable or not. > > What David said is right although it doesn't really make sense to extend > Process, at least not outside the JDK. If the API were introduced today then > it wouldn't have a public constructor, or maybe it would be a sealed > hierarchy. It's possible of course that that there are Process > implementations for testing or delegation but unlikely a "real > implementation". Its easy enough to use an atomic update to achieve the idempotent behavior. But two racing threads calling close raise the question of the state after close returns. To assert that the process has been "closed" then both threads have to wait until its finished. The normal developer would expect that close is complete after return; so somebody has to wait. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26649#discussion_r2291040378