Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 might 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 might occur while executing {{catch}} or {{finally}} blocks \[[Sun 1999|AA. Bibliography#SunReferences#Sun 99]\]. Consequently, programs must not invoke {{Thread.stop()}}.

...

Wiki Markup
However, the {{Thread.stop()}} method causes the thread to stop what it is doing and throw a {{ThreadDeath}} exception. All acquired locks are subsequently released \[[API 2006|AA. Bibliography#APIReferences#API 06]\]. If the thread were in the process of adding a new integer to the vector when it was stopped, the vector would become accessible while it is in an inconsistent state. For example, this could result in {{Vector.size()}} returning an incorrect element count because the element count is incremented after adding the element.

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="64305e989e8354d2-f5443be7-4e6141b4-89018ae2-045eab58f932185490ea17ea"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API References#API 06]]

Class Thread, method stop, interface ExecutorService

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="8a84eb200b132513-99ad6396-4adb44e7-9662b867-ffec39d17fd920c269629f7f"><ac:plain-text-body><![CDATA[

[[Sun 1999

AA. Bibliography#Sun References#Sun 99]]

 

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="0e34e7be54c264e5-07ca1fda-419e4ed3-9f4ca88b-9f0ce8763fa8a6f5a5e7fdb6"><ac:plain-text-body><![CDATA[

[[Darwin 2004

AA. Bibliography#Darwin References#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="0e5e3ec4e7b40bb9-cb8231e2-404d4af2-ad9bbb0f-6f064307dff7ac43576dc8df"><ac:plain-text-body><![CDATA[

[[JDK7 2008

AA. Bibliography#JDK7 References#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="68374beb4b363131-58b98f12-478645f1-ba598db0-56fa6379a3a5522114adae3b"><ac:plain-text-body><![CDATA[

[[JPL 2006

AA. Bibliography#JPL References#JPL 06]]

14.12.1, Don't Stop; 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="638a19689e7672cd-6775c2e3-4031476b-a152b43f-99590c37677784f6f487e053"><ac:plain-text-body><![CDATA[

[[JavaThreads 2004

AA. Bibliography#JavaThreads References#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="6dd73010a9beed29-72e7f302-44294ec6-8992acf8-008ba6c87e0dcbb95e325b15"><ac:plain-text-body><![CDATA[

[[Goetz 2006

AA. Bibliography#Goetz References#Goetz 06]]

Chapter 7, Cancellation and Shutdown

]]></ac:plain-text-body></ac:structured-macro>

...