• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

InterruptedException

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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":

 
reply
    Bookmark Topic Watch Topic
  • New Topic