Only cancel pending requests as last resort before stopping the Communiqué instance. Canceling a request can lead to an unstable instance. Stopping a thread causes it to unlock all the monitors that it has locked. (The monitors are unlocked as the ThreadDeath exception propagates up the stack.) If any of the objects that these monitors previously protected were in an inconsistent state, it's possible that other threads now view these objects in an inconsistent state. Such objects are said to be damaged. When threads operate on damaged objects, arbitrary behavior can result.
This behavior can be subtle and difficult to detect, or it could be pronounced. Unlike other unchecked exceptions, ThreadDeath kills threads silently. Therefore, the user has no warning that the program is corrupted. The corruption can manifest itself at any time after the actual damage occurs, even hours or days in the future.

Questo prodotto è concesso in licenza in base alla licenza di Attribuzione-Non commerciale-Condividi allo stesso modo 3.0 Unported di Creative Commons.  I post su Twitter™ e Facebook non sono coperti dai termini di Creative Commons.

Note legali   |   Informativa sulla privacy online