The specification for JNI's DestroyJavaVM starts with:
"Unloads a Java VM and reclaims its resources."
but then ends with:
"Unloading of the VM is not supported."
which is a direct contradiction and leaves it very unclear what DestroyJavaVM actually does.
The original JNI programmers book (which was the precursor to the spec document) states the following:
The support for DestroyJavaVM was not complete in JDK
release 1.1; only the main thread may call DestroyJavaVM. The
virtual machine implementation blocks until the main thread is
the only user-level thread and returns a negative error code.
Java 2 SDK release 1.2 still does not support unloading virtual
machine instances. There is a slight relaxation to the use of
DestroyJavaVM, however; any thread may call DestroyJavaVM.
The virtual machine implementation blocks until the current
thread is the only user thread before it returns an error code.
---
I think the final sentence in the spec is what is left of that block of text. Obviously we improved things to the point where it does actually "terminate" the VM by some definition and returns JNI_OK rather than an error code. But it remains true that the VM is not actually unloaded from the process, and only some resources are reclaimed. The specification needs to be updated to clarify this.
"Unloads a Java VM and reclaims its resources."
but then ends with:
"Unloading of the VM is not supported."
which is a direct contradiction and leaves it very unclear what DestroyJavaVM actually does.
The original JNI programmers book (which was the precursor to the spec document) states the following:
The support for DestroyJavaVM was not complete in JDK
release 1.1; only the main thread may call DestroyJavaVM. The
virtual machine implementation blocks until the main thread is
the only user-level thread and returns a negative error code.
Java 2 SDK release 1.2 still does not support unloading virtual
machine instances. There is a slight relaxation to the use of
DestroyJavaVM, however; any thread may call DestroyJavaVM.
The virtual machine implementation blocks until the current
thread is the only user thread before it returns an error code.
---
I think the final sentence in the spec is what is left of that block of text. Obviously we improved things to the point where it does actually "terminate" the VM by some definition and returns JNI_OK rather than an error code. But it remains true that the VM is not actually unloaded from the process, and only some resources are reclaimed. The specification needs to be updated to clarify this.
- csr for
-
JDK-8273971 Clarify the specification of JNI DestroyJavaVM in relation to "unloading the VM"
-
- Closed
-
- relates to
-
JDK-6701692 DestroyJavaVM specification needs clarification
-
- Resolved
-
-
JDK-6283297 JNI_CreateJavaVM spec clarification
-
- Closed
-
-
JDK-8290036 Define and specify Runtime shutdown sequence
-
- Resolved
-
-
JDK-8290196 12.8: Clarify the definition of program exit
-
- Resolved
-