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

Deprecate Thread.suspend/resume for removal

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 14
    • core-libs
    • None
    • behavioral
    • low
    • The deprecation warning changes so a project compiling with `-Xlint:all,-deprecation -Werror` today will need to change to use `-removal`.
    • Java API
    • SE

      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.

            alanb Alan Bateman
            alanb Alan Bateman
            Chris Hegarty, David Holmes, Mandy Chung (Inactive), Martin Buchholz, Stuart Marks
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: