...
Wiki Markup |
---|
However, the {{Thread.stop()}} method causes the thread to stop what it is doing and throw a {{ThreadDeath}} exception, and release all locks that it has acquired \[[API 06|AA. Java References#API 06]\]. If the thread is in the process of adding a new integer to the vector when it is stopped, the vector may become accessible while it is in an inconsistent state. For example, {{Vector.size()}} may be threetwo while the vector only contains twothree elements (the element count is incremented after adding the element). |
Compliant Solution (volatile
flag)
...