[concurrency-interest] Hung progress in ThreadPoolExecutor ExecutorCompletionService when slave threads killed.

Gregg Wonderly gregg at cytetech.com
Mon May 14 16:44:00 EDT 2012


On 5/13/2012 10:34 PM, Zhong Yu wrote:
> If an exception can occur any where any time, it is impossible to
> write code that can survive it and maintain invariants.
>
>      lock
>          x++;
>          y++;
>      unlock
>
> If we have to worry that some exception may be thrown between x++ and
> y++, we cannot write any program at all.
>
> ThreadDeath is exactly such an exception.
>
> Others include OutOfMemoryError and StackOverflowError - they are more
> predictable, but still, we cannot afford to worry about them on every
> `new` and every method call.

This, for me, is why STM and other forms of transactional state management are 
needed.  It should be simple to say "All of this is an atomic view" which the VM 
will then maintain as consistent, no matter what kind of fault occurs.

Gregg Wonderly


More information about the Concurrency-interest mailing list