RFR: 8288984: Simplification in Shutdown.exit [v2]

Chris Hegarty chegar at openjdk.org
Mon Jul 4 08:11:43 UTC 2022


On Mon, 4 Jul 2022 01:57:11 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> Is "deadlock" accurate?

Yes.

In the context of the specification, "shutdown hook" means _application_ shutdown hook - as far as the specification is concerned, application shutdown hooks are the only kind of hooks. Right?

For example, the following will deadlock (when run with the changes in this PR):


public class TestHook {
  public static void main(String... arg) {
    Thread hook = new Thread("my-hook") {
      @Override
      public void run() {
        System.exit(1);
      }
    };
    Runtime.getRuntime().addShutdownHook(hook);
    System.exit(0);
  }
}

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

PR: https://git.openjdk.org/jdk/pull/9351


More information about the core-libs-dev mailing list