RFR: JDK-8202105: jshell tool: on exiting, terminal echo is disabled

Jan Lahoda jan.lahoda at oracle.com
Thu Apr 26 20:34:11 UTC 2018


On 26.4.2018 20:09, Xueming Shen wrote:
> On 4/26/18, 3:23 AM, Jan Lahoda wrote:
>> On 25.4.2018 22:59, Xueming Shen wrote:
>>> On 04/25/2018 01:39 PM, Jan Lahoda wrote:
>>>> So, if I understand correctly, it would be:
>>>> boolean flipEcho;
>>>> and the readPassword would do something like:
>>>> if (echo0() != false) {
>>>
>>> if (echo0()) { ...
>>>
>>>>     flipEcho = true;
>>>>     echo(false);
>>>> }
>>>> ....
>>>> if (flipEcho) { //this would also be in the shutdown hook
>>>>      echo(!echo0());
>>>> }
>>>
>>> if (flipEcho) {
>>>      echo(true);
>>>      flipEcho = false;
>>> }
>>> ?
>>
>> Hmm, right. It start to look a lot like the original code, with the
>> exception that the flag is also checked inside readPassword:
>> http://cr.openjdk.java.net/~jlahoda/8202105/webrev.01/
>>
>> (This also makes the shutdown hook registration lazy.)
>>
>> Jan
> shouldn't we move the installShutonwHookIfNeeded() into synced block? and
> simply name it "installShutdownHook()" ?

Ok, here is an updated webrev:
http://cr.openjdk.java.net/~jlahoda/8202105/webrev.02/

Jan

>
> the rest looks fine.
>
> -sherman


More information about the core-libs-dev mailing list