JDK 18 |
---|
18 b19Fixed |
CSR :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
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.
|