RFR: 8332084: Ensure JdkConsoleImpl.restoreEcho visibility in a shutdown hook

Pavel Rappo prappo at openjdk.org
Mon May 13 10:54:04 UTC 2024


On Fri, 10 May 2024 21:55:26 GMT, Naoto Sato <naoto at openjdk.org> wrote:

> Making sure `restoreEcho` correctly reflects the state in the shutdown thread, which differs from the application's thread that issues the `readPassword()` method.

Generally looks good.

It's hard to imagine that this shutdown hook might be reading `restoreEcho` concurrently with some other thread writing to it. So, our primary goal here is to ensure that whatever writes have been done to `restoreEcho` before the hook starts are seen by the hook.

While it's hard to test this change (hence the `noreg-hard` label), the `restoreEcho` functionality does not seem to be tested at all. Should we add a straightforward test for it, perhaps separately?

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

PR Review: https://git.openjdk.org/jdk/pull/19184#pullrequestreview-2052349894


More information about the core-libs-dev mailing list