-
Bug
-
Resolution: Unresolved
-
P3
-
17, 24, 25, 26
ADDITIONAL SYSTEM INFORMATION :
jdk-21.0.2+13 later
A DESCRIPTION OF THE PROBLEM :
The changes made inJDK-8301247 have caused the shutdown hook to stop working.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create App.java as follows.
```
public class App {
public static void main(String[] args) {
System.out.println("java.vm.version: " + System.getProperty("java.vm.version"));
Runtime.getRuntime().addShutdownHook(new Thread("My Shutdown Hook") {
public void run() {
System.out.println("ShutdownHook started");
try { Thread.sleep(3000); } catch (Exception e) { }
System.out.println("ShutdownHook finished");
}
});
while (true) {
try {
Thread.sleep(3000);
} catch (Exception e) {
e.printStackTrace();
}
System.out.print(".");
}
}
}
```
```
javac .\App.java
jar -cvfe libs\app.jar App *.class
jpackage --type app-image --win-console --name app --input libs --main-jar app.jar
.\app\app.exe
```
Run the application and press Ctrl-C.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
We expect the shutdown hook to complete processing.
In jdk-21.0.1+12, the shutdown hook runs and “ShutdownHook finished” is displayed.
ACTUAL -
In jdk-21.0.2+13, jdk-21.0.8+9, and other versions, “ShutdownHook finished” is not displayed and the shutdown hook processing is not completed.
jdk-21.0.2+13 later
A DESCRIPTION OF THE PROBLEM :
The changes made in
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create App.java as follows.
```
public class App {
public static void main(String[] args) {
System.out.println("java.vm.version: " + System.getProperty("java.vm.version"));
Runtime.getRuntime().addShutdownHook(new Thread("My Shutdown Hook") {
public void run() {
System.out.println("ShutdownHook started");
try { Thread.sleep(3000); } catch (Exception e) { }
System.out.println("ShutdownHook finished");
}
});
while (true) {
try {
Thread.sleep(3000);
} catch (Exception e) {
e.printStackTrace();
}
System.out.print(".");
}
}
}
```
```
javac .\App.java
jar -cvfe libs\app.jar App *.class
jpackage --type app-image --win-console --name app --input libs --main-jar app.jar
.\app\app.exe
```
Run the application and press Ctrl-C.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
We expect the shutdown hook to complete processing.
In jdk-21.0.1+12, the shutdown hook runs and “ShutdownHook finished” is displayed.
ACTUAL -
In jdk-21.0.2+13, jdk-21.0.8+9, and other versions, “ShutdownHook finished” is not displayed and the shutdown hook processing is not completed.
- caused by
-
JDK-8301247 JPackage app-image exe launches multiple exe's in JDK 17+
-
- Resolved
-