[concurrency-interest] Questions on ConcurrentHashMap

Thomas Hawtin Thomas.Hawtin at Sun.COM
Fri Nov 30 14:15:25 EST 2007

Carfield Yim wrote:
> May be you can refer to this article -
> http://www.javaspecialists.eu/archive/Issue146.html

Notice that Heinz breaks out of the loop.

In the example in this thread, we go around the loop again with 
interrupt set. So the task will get interrupted the first time it gets 
to a suitable point (wait, tryLock, etc). The catch block will then 
catch the exception, reset the status and loop again. The result is a 
lot of cycles and little result.

If you don't want to exit the loop, remember that an interrupt has 
happened, but don't reset the status. Go back around the loop. When the 
loop exits, then the interrupt status can be reapplied.

Tom Hawtin

> On 12/1/07, Tim Peierls <tim at peierls.net> wrote:
>>Sorry if this is obvious to everyone else, but I don't understand the
>>interrupt handling in the while loop. How does it terminate?

More information about the Concurrency-interest mailing list