Review request for 6829503
Rémi Forax
forax at univ-mlv.fr
Sat Apr 18 13:20:29 UTC 2009
Xueming Shen a écrit :
[...]
> Two use scenarios
>
> (1) jvm is being terminated "abnormally" during a password reading
> operation (during "normal" application
> operation), in which the echo is in "off" mode when these shutdown
> hooks start to be invoked. Without
> the "console restore first", application hooks probably can do nothing
> with the stdin/console
>
> (2)Application hooks use Console.readPassword() and then be terminated
> "abnormally" during the reading,
> in which the echo mode is kept in "off" mode and will not be restored
> after app exits.
>
> The reason the console hook was/is added to run first is we weighed
> the first scenario as a more likely
> scenario in real world application. Note, the Console echo mode is not
> required to be "restored" if the
> reading operation finishes normally.
>
> Maybe we can consider to run the console hook again (if the hook is
> set) after the application hooks?
>
> Sherman
The other solution is to provide a way in the API to test if shutdown hooks
have been started or not.
In that case, all application codes that start a shutdown hook like
Console.readPassword()
can check if shudown hooks run or not and throw a runtime exception
if shutdown hook run.
Rémi
More information about the core-libs-dev
mailing list