RFR: 8332084: Ensure JdkConsoleImpl.restoreEcho visibility in a shutdown hook [v8]
Naoto Sato
naoto at openjdk.org
Wed May 22 19:35:03 UTC 2024
On Wed, 22 May 2024 18:35:40 GMT, Pavel Rappo <prappo at openjdk.org> wrote:
> I might be confused, but what if the shutdown hook completes and then some application thread enters `readPassword`. If that thread manages to turn off echo before all other shutdown hooks complete, it might never execute `finally`, hence a race.
Yes, that is possible. However I would say that it is equally unlikely as an app installs a shutdown hook with readPassword(), so I think this is OK too. BTW, if an app issues `Runtime.halt()` while `readPassword()` is waiting, then those shutdown hooks aren't even executed, thus ends up in not restoring the echo without a race, which I think is OK as well.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19184#issuecomment-2125602570
More information about the core-libs-dev
mailing list