Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: significant revision of stopThread CS

...

A thread may use interruption for performing tasks other than cancellation and shutdown. Consequently, a thread should not be interrupted unless its interruption policy is known in advance. Failure to follow this advice can result in failed interruption requests.

Compliant Solution (RuntimePermission Runtime Permission stopThread)

Remove Removing the default permission java.lang.RuntimePermission stopThread from the security policy file to deny prevents threads from being stopped using the Thread.stop() invoking code, the required privileges method. This approach is not recommended for trusted, custom-developed code that uses the Thread.stop() as the existing design presumably depends upon the ability of the system to perform this action. Furthermore, the system may not be designed to properly handle the resulting exception. In these cases, it is preferable to implement an alternate design approach corresponding to one of other compliant solutions described in this guideline.

Risk Assessment

Forcing a thread to stop can result in inconsistent object state. Critical resources may also leak if clean-up operations are not carried out as required.

...