Hi all,

I just spent quite a while tracking down a bug with  
java.util.concurrent locks that for me caused a deadlock in my test  
application, but that might also be the cause of many other locking  
related problems we've seen. It all boiled down to an assumption that  
checked for Thread.interrupted() to check for the interruption of a  
blocking action (like lockInterruptibly()). However, throwing  
InterruptedException doesn't mean that the current thread is  
interrupted, it means that a blocking action was interrupted. Using  
Thread.interrupted() to check if a blocking action was interrupted is  
thus wrong and will not give the correct results. Thread.interrupted()  
checks for the interruption flag which is basically set by using the  
interrupt() method on a thread.

Just thought I'd point this out since I never really reflected on this  
difference before either.

Take care,

Geert

--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com

_______________________________________________
tc-dev mailing list
[email protected]
http://lists.terracotta.org/mailman/listinfo/tc-dev

Reply via email to