[concurrency-interest] InterruptedException-free wrappers for calls that "will never be interrupted"

Boehm, Hans hans.boehm at hp.com
Fri Apr 9 15:42:16 EDT 2010


> From:  Doug Lea
> It has always been odd that built-in locks cannot 
> throw IE yet built-in waits must throw IE.
I'm not sure I quite understand this comment.

This still strikes me as reasonable behavior in the large majority of cases, though you can clearly find occasional cases for which it's inappropriate.  Most code avoids waiting for a lock for extended periods, while wait() is clearly used routinely to block for arbitrary time periods.  This also seems closely related to whether or not you want to accommodate timeouts, where we make a similar distinction.

Hans
 
> This is one reason 
> to use ReentrantLock etc, which support all the possible 
> forms. Perhaps this distinction should have been more 
> uniformly propagated to other blocking methods. Perhaps it 
> still could.
> 



More information about the Concurrency-interest mailing list