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

(doc) target thread won't miss the interruption

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 7
    • Component/s: docs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b110
    • CPU:
      x86
    • OS:
      windows_xp
    • Verification:
      Verified

      Description

      A DESCRIPTION OF THE PROBLEM :
      The document (http://java.sun.com/j2se/1.5.0/docs/guide/misc/threadPrimitiveDeprecation.html) says 'If the stop method calls Thread.interrupt, as described above, it needn't call notify as well, but it still must be synchronized. This ensures that the target thread won't miss an interrupt due to a race condition.' in 'Can I combine the two techniques to produce a thread that may be safely "stopped" or "suspended"?' If the target thread is notified before it waits a notification, it may miss the notification. But, even if the target thread is interrupted before it waits a notification, it won't miss the interruption.
      I think the stop() method still must be synchronized if the blinker isn't volatile, too. If so, the run() method must be modified. I think the declaration of blinker should be described:
      private volatile boolean blinker;

      # The declaration of threadSuspended in 'What should I use instead of Thread.suspend and Thread.resume?' is wrong:
      # private boolean volatile threadSuspended;
      # It can not be compiled.
      # http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4514860


      URL OF FAULTY DOCUMENTATION :
      http://java.sun.com/j2se/1.5.0/docs/guide/misc/threadPrimitiveDeprecation.html

        Attachments

          Activity

            People

            • Assignee:
              sharonz Sharon Zakhour (Inactive)
              Reporter:
              rmandalasunw Ranjith Mandala (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: