Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8332084

Ensure JdkConsoleImpl.restoreEcho visibility in a shutdown hook

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 23
    • 23
    • core-libs
    • b25

      Access to jdk.internal.io.JdkConsoleImpl.restoreEcho in this runnable should be guarded by readLock:
       
                  // Add a shutdown hook to restore console's echo state should
                  // it be necessary.
                  SharedSecrets.getJavaLangAccess()
                          .registerShutdownHook(0 /* shutdown hook invocation order */,
                                  false /* only register if shutdown is not in progress */,
                                  new Runnable() {
                                      public void run() {
                                          try {
                                              if (restoreEcho) {
                                                  echo(true);
                                              }
                                          } catch (IOException x) { }
                                      }
                                  });

            naoto Naoto Sato
            prappo Pavel Rappo
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: