This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "InterruptedException" Watch "InterruptedException" New topic


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

Roel De Nijs

Joined: Jul 19, 2004
Posts: 8411

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,

SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
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:
subject: InterruptedException
jQuery in Action, 3rd edition