• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I hundle the InterruptedException ?

 
Mike Tilling
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

What is the appropriate message that the client should receive when an InterruptedException occures on the server?

BestRegards
 
Kai Witte
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

I assume that you never interrupt a Thread. Thus it should not be possible, and so the best thing to do is to wrap it into an AssertionError or a subclass of RuntimeException, for example IllegalStateException. Use Thread.setDefaultUncaughtExceptionHandler (in the client or in the server?) to handle any unexpected situation like that. Your custom handler should display an error message dialog saying something like "Unexpected internal program error. Please contact the support.". It has a button to close the program (and exit? - maybe better not) and a button to show the stack trace.

Kai
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic