Avoiding the use of deprecated methods

The Java concurrency API also has deprecated operations. These are operations that were included in the first versions of the API, but now you shouldn't use them. They have been replaced by other operations that implement better practices than the original ones.

The more critical deprecated operations are those that are provided by the Thread class. These operations are:

  • destroy(): In the past, this method destroyed the thread. Actually, it throws a NoSuchMethodError exception.
  • suspend(): This method suspends the execution of the thread until it's resumed.
  • stop(): This method forces the thread to finish its execution.
  • resume(): This method resumes the execution of the thread.

The ThreadGroup class ...

Get Java 9 Concurrency Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.