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

Deprecate Thread.suspend/resume for removal

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 14
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      low
    • Compatibility Risk Description:
      The deprecation warning changes so a project compiling with `-Xlint:all,-deprecation -Werror` today will need to change to use `-removal`.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Deprecate, for removal, the methods in java.lang.Thread and java.lang.ThreadGroup that relate to thread suspension, specifically:

      • Thread.suspend()
      • Thread.resume()
      • ThreadGroup.suspend()
      • ThreadGroup.resume()
      • ThreadGroup.allowThreadSuspension(boolean)

      These methods have been deprecated since Java SE 1.2 (1998).

      Problem

      Suspension is inherently deadlock-prone, these APIs have linked to the "Java Thread Primitive Deprecation" page since they were deprecated.

      A second issue is that Project Loom is exploring adding support for "lightweight threads" where the notion of suspension will be very different to that defined by the legacy thread suspension mechanism.

      Solution

      Add "forRemoval=true" to the Deprecated annotation on these methods.

      No deprecation or changes are proposed to the equivalent APIs in JVM TI or JDI as these are important for debugger operations.

      Specification

      The addition of "forRemoval=true" will result in the API docs including a removal warning in the "Deprecated" message.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alanb Alan Bateman
                Reporter:
                alanb Alan Bateman
                Reviewed By:
                Chris Hegarty, David Holmes, Mandy Chung, Martin Buchholz, Stuart Marks
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: