Paskutinį kartą atnaujinta
2021-05-20
|
Taip pat taikoma Communiqué, Communiqué 3, Communiqué 4
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.