• Post Reply Bookmark Topic Watch Topic
  • New Topic

Centralized catch for all threads

 
vivek bawge
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
the main ui class in my project calls a method that spawns several threads. I want to know if there is a way i can put a centralized catch so that all the exceptions are caught in this.
e.g MainUI.java
..
try{
//this method spawns several threads which may throw exceptions
ProjectManager.analyze();
}catch(Throwable t){
LogError("Exception" + t + "in some thread spasned by PM.analyze");
}

Thanks in advance,
Vivek
 
vivek bawge
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi folks,
the response is very discouraging.
atleast let me know if at all there is any solutionn to this problem.
expecting at least some reply.
pl help
Thanks,
Vivek
 
Kris Schneider
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, there's at least a way to handle uncaught exceptions if your spawned threads belong to the same ThreadGroup. Create a ThreadGroup subclass and override its uncaughtException method. When creating your threads, be sure to use the constructor that takes a ThreadGroup instance. Hope that helps.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!