wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes InterruptedException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "InterruptedException" Watch "InterruptedException" New topic
Author

InterruptedException

pramod karnani
Ranch Hand

Joined: May 22, 2007
Posts: 88
Hi All,

when InterruptedException is being catch in lock method since wait throws InterruptedException then can I wrap InterruptedException within a subclass of RuntimeException ?

let say subclass is UserInterruptedException that extends RuntimeException


Regards,
Pramod
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5216
    
  12

Hi pramod,

I posted a question about how to handle the InterruptedException (more than a month ago) and got no replies at all. The thread can be found here and has a link to a website with an article about "how to handle InterruptedException?", so it's maybe valuable to you

Kind regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Alecsandru Cocarla
Ranch Hand

Joined: Feb 29, 2008
Posts: 158
I did not read that article before submitting my assignment, so I just swallowed the exception and continued to wait. However, I don't think I'd have changed my approach. But I had a TimeoutException, which means anyway, after 5 seconds, the thread exits. So swallowing is just a delay, there's no possibility that my thread remains stuck, waiting forever.

This is my "InterruptedException code":



SCJP 1.4 100%
SCJD 99.5%
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: InterruptedException