Javamex

Java discussion forum to accompany the Javamex web site.

happy goofy's Discussions

Handle InterruptedException

Started this discussion. Last reply by happy goofy Mar 20, 2012. 2 Replies

I see recommendation of handling InterruptedException to keep the interrupt flag,  like this:catch (InterruptedException iex) {   Thread.currentThread().interrupt();} But, if you do this, the thread…Continue

Gifts Received

Gift

happy goofy has not received any gifts yet

Give a Gift

 

happy goofy's Page

Latest Activity

happy goofy replied to Pallav Shyam's discussion notify vs notifyall
"I ran this in Solaris. When the waiting dead lock happens, press ctl+\.  (SIGQUIT, 3).  On Windows, try ctl + break. This problem may result if the program creates say 5 producers and 1 consumer, and each can wake up just one other thread,…"
Apr 11, 2012
happy goofy replied to Pallav Shyam's discussion notify vs notifyall
"This program creates 1 producer thread and 5 consumer threads, all synchronized on an Object of type ArrayList. With notify (not notifyAll) executed by each thread , there will be,of course, at most one thread running (RUNNABLE), at most…"
Apr 10, 2012
happy goofy replied to happy goofy's discussion Handle InterruptedException
"Neil, right I posted my question. I tried compiling and running them in Windows where java 1.6 HAPPENED to be used to do so. I did not see the problem in java 1.6. So this is bug in java 1.5.  Thanks for getting back so quickly."
Mar 20, 2012
Neil Coffey replied to happy goofy's discussion Handle InterruptedException
"In terms of its defined behaviour, calling interrupt() on a thread does not make the thread end and doesn't prevent the finally clause from being executed. So you either have another bug in your code or a bug in your VM. Have you tried running…"
Mar 20, 2012
happy goofy posted a discussion

Handle InterruptedException

I see recommendation of handling InterruptedException to keep the interrupt flag,  like this:catch (InterruptedException iex) {   Thread.currentThread().interrupt();} But, if you do this, the thread ends immediately. If you have a finally clause after catch clause, it won't run. Even worse, all statements after the try/catch/finally won't run. I said, this ends the thread immediately, the whole stach cleared, no Exception rethrown. I feel this is an odd sematics - a big bug.I am attaching two…See More
Mar 20, 2012
happy goofy replied to Pallav Shyam's discussion notify vs notifyall
"I replaced reply for replyAll as indicated in the source. I kept runnning it for some times. Yes, I saw the deadlock. Anyone got an insight?"
Mar 20, 2012
happy goofy is now a member of Javamex
Mar 20, 2012

Profile Information

What other languages do you use apart from Java?
C++, Perl

Comment Wall

You need to be a member of Javamex to add comments!

Join Javamex

  • No comments yet!
 
 
 

© 2017   Created by Neil Coffey.   Powered by

Badges  |  Report an Issue  |  Terms of Service