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="e6d47a81178ab109-f18cadad-42f44b23-bbda99f6-a8db6006e8f39b4114869162"><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="1c6a91ad71e6b6b0-c7946409-48264f70-9fe8bcd5-0575c78416ab4aaeaa95a0fd"><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="bf6694ef1d2e6d60-7f9eff94-47b54805-b35a83ba-a1f0132087f217b2daa4ae3a"><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="9d5b0bb6fe47b806-d686248a-4e22461e-aac6a05f-bd7d935059cfb37bef900999"><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="8ef0ecff24efe3b5-c1f12645-41194fa3-999a8c2d-99d9bd12817f688022a2e80e"><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="79cf171593522284-190923c3-4d004c17-abedad4f-414fb162af7ebf857c2339d2"><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="b66f58489143b807-1829fa5d-4cb445a1-a74fbb0b-95da614a69d3a645ab4d1bf3"><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>

...