RFR: 8289613: Drop use of Thread.stop in jshell [v4]

Adam Sotona asotona at openjdk.org
Thu Sep 8 08:40:00 UTC 2022


On Wed, 7 Sep 2022 19:48:56 GMT, ExE Boss <duke at openjdk.org> wrote:

>> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Minor formating fixes
>
> src/jdk.jshell/share/classes/jdk/jshell/execution/LocalExecutionControl.java line 51:
> 
>> 49:     private boolean userCodeRunning = false;
>> 50:     private ThreadGroup execThreadGroup;
>> 51:     private Field allStop = null;
> 
> It might be better to use a `VarHandle` for this (as it doesn’t need boxing or access checks on every access).

According to javadoc VarHandle of static field "effectively ignore the volatile declaration".
Volatility of REPL.$Cancel.allStop field is critical for this use case.

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

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


More information about the core-libs-dev mailing list