On Mon, 5 Sep 2022 14:42:56 GMT, Adam Sotona <asot...@openjdk.org> wrote:
>> This is the last usage of Thread.stop in the JDK so this change is welcome. >> >> The instrumentation to check a flag at jump instrumentation looks >> reasonable, and works here because the method is public on a public class in >> an exported package. I hadn't noticed that jdk.jshell.execution is exported >> and the addition to LocalExecutionControl means it's a new API so I assume >> forces you to write javadoc. >> >> If a user presses control-C in jshell does it also interrupt the thread or >> will it just set the stop flag? If it also interrupts then you have another >> choice to check the interrupt status (assumes all code is well behaved of >> course). >> >> Is there one or many LocalExecutionControl objects when I execute a snippet, >> control-C, execute another? I'm wondering because the allStop flag is static >> but STOP_LOCK is per instance. > > I think @AlanBateman proposal to monitor interrupted status is easy to > implement and also does not require a new public method nor synthetic class. @asotona, the problem is that user code may also react to the interrupted status, the cancelling has be a mechanism a user can not trigger directly. ------------- PR: https://git.openjdk.org/jdk/pull/10166