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

Update JNI Specification of DestroyJavaVM for better alignment with JLS, JVMS, and Java SE API Specifications

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 20
    • 20
    • hotspot
    • b17

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              dholmes David Holmes
              smarks Stuart Marks
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: