Summary
Generalize the specification of DestroyJavaVM
to refer to termination, and replace contradictory statements about the "unloading" of the VM.
Problem
The specification for DestroyJavaVM
contains the remnant of a historical note that unloading of the VM is not supported. This appears as an isolated statement after the "Returns:" section of the function specification, and appears to directly contradict the function description which states "Unloads a Java VM".
Solution
Generalize the specification of DestroyJavaVM to refer to termination, in a way compatible with the Hotspot implementation and other implementations.
Specification
Replace the function description:
Unloads a Java VM and reclaims its resources.
with:
Terminates the operation of the JVM, making a best-effort attempt to release resources.
Delete the final statement:
Unloading of the VM is not supported.
Replace other references to "unloading" the VM with "terminating" the VM. These occur in the overview discussion of the "Invocation API" section.
Terminating the VM
The
JNI_DestroyJavaVM()
function terminates a Java VM.The VM waits until the current thread is the only non-daemon user thread before it actually terminates. User threads include both Java threads and attached native threads. This restriction exists because a Java thread or attached native thread may be holding system resources, such as locks, windows, and so on. The VM cannot automatically free these resources. By restricting the current thread to be the only running thread when the VM is terminated, the burden of releasing system resources held by arbitrary threads is on the programmer.
- csr of
-
JDK-8273302 Clarify the specification of JNI DestroyJavaVM in relation to "unloading the VM"
-
- Resolved
-