RFR: 8321163: [test] OutputAnalyzer.getExitValue() unnecessarily logs even when process has already completed [v2]
Stefan Karlsson
stefank at openjdk.org
Fri Dec 1 12:12:07 UTC 2023
On Fri, 1 Dec 2023 11:14:04 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> test/lib/jdk/test/lib/process/OutputBuffer.java line 150:
>>
>>> 148: @Override
>>> 149: public int getExitValue() {
>>> 150: Integer exitCode = this.processExitCode;
>>
>> Do we really need the local `exitCode` variable? Even if another multiple threads write to processExitCode, I expect them to all write a non-null Integer.
>
> Hello Stefan, this is just for a tiny optimization to prevent multiple reads (in the same thread) on the `volatile` field `processExitCode` in this method.
I don't think such an optimization is needed here. This is not performance-critical code.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16919#discussion_r1412028528
More information about the core-libs-dev
mailing list