Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8273971

Clarify the specification of JNI DestroyJavaVM in relation to "unloading the VM"

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 18
    • hotspot
    • None
    • behavioral
    • minimal
    • Hide
      The specification is effectively loosened such that the Hotspot implementation now conforms. Any other VM implementation that was already conformant (by unloading the VM) remains so; other VM implementations not previously conformant in a way similar to Hotspot may now also be conformant.
      Show
      The specification is effectively loosened such that the Hotspot implementation now conforms. Any other VM implementation that was already conformant (by unloading the VM) remains so; other VM implementations not previously conformant in a way similar to Hotspot may now also be conformant.
    • Other
    • SE

      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.

            dholmes David Holmes
            dholmes David Holmes
            Daniel Daugherty, Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: