There are some updates pending to the JVMS, JLS, and the specification of java.lang.Runtime in the Java SE API that clarify the JDK shutdown sequence, JVM halt, and program exit. The JNI Specification will need some updates to align with these changes.
Specific points include:
* The Overview in Chapter 5 includes a small section "Terminating the VM" which refers to "JNI_DestroyJavaVM" (name isn't quite right) which mentions "user threads" and the possibility of "holding system resources" and how the VM cannot automatically free them. It seems like this discussion isn't very helpful. Probably all that's necessary here is a forward reference to the DestroyJavaVM function later in this chapter.
* The specification of the DestroyJavaVM function mentions that it "terminates" the VM and makes a "best-effort attempt to release resources". It should mention something about initiating the _shutdown sequence_ (to be defined in the java.lang.Runtime class specification). Adding a link here is probably sufficient here.
* I don't think this function actually halts the VM itself; I believe it waits for something on the JDK side to halt the VM. (The JDK calls Runtime.halt at the end of the shutdown sequence, or any thread can call Runtime.halt directly.) But what this function actually does should be specified.
* The discussion about DestroyJavaVM waiting for the current thread to be the only non-daemon thread should be clarified to cover the case where the current thread is a daemon thread.
* There probably should be some statement about the state of the VM after this call returns. Presumably on success it means that the JVM has halted (no Java code is being executed) or similar.
* The main table of contents has an entry in Chapter 5, Overview, "Unloading the VM" which points to nowhere (but probably is intended to point to the "Terminating the VM" section.
Specific points include:
* The Overview in Chapter 5 includes a small section "Terminating the VM" which refers to "JNI_DestroyJavaVM" (name isn't quite right) which mentions "user threads" and the possibility of "holding system resources" and how the VM cannot automatically free them. It seems like this discussion isn't very helpful. Probably all that's necessary here is a forward reference to the DestroyJavaVM function later in this chapter.
* The specification of the DestroyJavaVM function mentions that it "terminates" the VM and makes a "best-effort attempt to release resources". It should mention something about initiating the _shutdown sequence_ (to be defined in the java.lang.Runtime class specification). Adding a link here is probably sufficient here.
* I don't think this function actually halts the VM itself; I believe it waits for something on the JDK side to halt the VM. (The JDK calls Runtime.halt at the end of the shutdown sequence, or any thread can call Runtime.halt directly.) But what this function actually does should be specified.
* The discussion about DestroyJavaVM waiting for the current thread to be the only non-daemon thread should be clarified to cover the case where the current thread is a daemon thread.
* There probably should be some statement about the state of the VM after this call returns. Presumably on success it means that the JVM has halted (no Java code is being executed) or similar.
* The main table of contents has an entry in Chapter 5, Overview, "Unloading the VM" which points to nowhere (but probably is intended to point to the "Terminating the VM" section.
- csr for
-
JDK-8292897 Update JNI Specification of DestroyJavaVM for better alignment with JLS, JVMS, and Java SE API Specifications
- Closed
- relates to
-
JDK-8303841 Update the JNI spec GetVersion function to reflect the change to JNI_VERSION_20
- Resolved
-
JDK-8290036 Define and specify Runtime shutdown sequence
- Resolved
-
JDK-8290196 12.8: Clarify the definition of program exit
- Resolved
-
JDK-8290388 5.7: Clarify the definition of JVM termination
- Resolved
-
JDK-8291955 Cleanup the JNI invocation API spec and code examples
- Resolved
(1 relates to, 2 links to)