...
Certain thread APIs were introduced to facilitate thread suspension, resumption, and termination but were later deprecated due to because of inherent design weaknesses. For example, the Thread.stop()
method causes the thread to immediately throw a ThreadDeath
exception, which usually stops the thread.
Wiki Markup |
---|
Invoking {{Thread.stop()}} results in the release of all locks a thread has acquired, potentially exposing the objects protected by those locks when those objects are in an inconsistent state. The thread could catch the {{ThreadDeath}} exception and use a {{finally}} block in an attempt to repair the inconsistent object or objects. However, this requires careful inspection of all synchronized methods and blocks because a {{ThreadDeath}} exception can be thrown at any point during the thread's execution. Furthermore, code must be protected from {{ThreadDeath}} exceptions that could result when executing {{catch}} or {{finally}} blocks \[[Sun 1999|AA. Bibliography#Sun 99]\]. Consequently, use ofprograms must not invoke the {{Thread.stop()}} method is forbidden. |
More information about deprecated methods is available in rule MET02-J. Do not use deprecated or obsolete classes or methods. Also, refer to rule ERR09-J. Do not allow untrusted code to terminate the JVM for information on preventing data corruption when the JVM is shut down abruptly.
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7b81bcacb590ad74-de7314a3-44f64dc2-b54aa992-84a05d1ab79c9e08af38c0eb"><ac:plain-text-body><![CDATA[ | [[API 2006 | AA. Bibliography#API 06]] | Class Thread, method | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="3da5d9410ff1fb20-a095e3b9-49464d62-b641bc35-10f689e15033c2c146c99ceb"><ac:plain-text-body><![CDATA[ | [[Sun 1999 | AA. Bibliography#Sun 99]] |
| ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="813763a7d55354fd-c514d5dc-42db4324-86f78dcc-fa7c48778e65658a06bec4f9"><ac:plain-text-body><![CDATA[ | [[Darwin 2004 | AA. Bibliography#Darwin 04]] | 24.3 Stopping a Thread | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="10d5b3288b434cba-fb3d3ef5-48cc4231-8f05b534-b437157ebfb0a3a9f9dc9ceb"><ac:plain-text-body><![CDATA[ | [[JDK7 2008 | AA. Bibliography#JDK7 08]] | Concurrency Utilities, More information: Java Thread Primitive Deprecation | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="121d561a8fa40a92-c9198989-4d3d464b-97a3a526-8bdecc86a6f2ef022a683d83"><ac:plain-text-body><![CDATA[ | [[JPL 2006 | AA. Bibliography#JPL 06]] | 14.12.1. Don't stop and 23.3.3. Shutdown Strategies | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="91bf14bcaf526e4b-436c94d9-425647b4-94e882ed-8f847261c378111b5cb06287"><ac:plain-text-body><![CDATA[ | [[JavaThreads 2004 | AA. Bibliography#JavaThreads 04]] | 2.4 Two Approaches to Stopping a Thread | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="6f8971d7966954a3-ce453802-45ce4155-98038f17-2309fed23a74c8d1464e64ed"><ac:plain-text-body><![CDATA[ | [[Goetz 2006 | AA. Bibliography#Goetz 06]] | Chapter 7: Cancellation and shutdown | ]]></ac:plain-text-body></ac:structured-macro> |
...