On Wed, 15 Feb 2023 06:41:17 GMT, Yi Yang <yy...@openjdk.org> wrote:

>> src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java 
>> line 455:
>> 
>>> 453:             if (fd != -1) {
>>> 454:                 close(fd);
>>> 455:             }
>> 
>> There used to be logic to set `fd` (previously called `s`) to -1 during the 
>> close operation. Is that no longer needed?
>
> Hi @plummercj , sorry for late reply. 
> 
> I don't see why we need it because this method is protected by synchronized. 
> fd is only set by ctor.

You will end up leaving fd set even after the close completes.  A subsequent 
close (which I assume should never happen) would end up with an IOException. 
Previously close would end up not doing anything when called again, and simply 
return with no error. I'm not sure which is the best behavior in this case, but 
it is a change in behavior.

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

PR: https://git.openjdk.org/jdk/pull/11823

Reply via email to