RFR: 8299518: HotSpotVirtualMachine shared code across different platforms [v6]
Chris Plummer
cjplummer at openjdk.org
Mon Feb 27 17:51:10 UTC 2023
On Wed, 15 Feb 2023 06:41:17 GMT, Yi Yang <yyang at 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
More information about the serviceability-dev
mailing list