Skip to main content



      Home
Home » Eclipse Projects » Virgo » How to implement catch all type exception handler
How to implement catch all type exception handler [message #695771] Tue, 12 July 2011 10:12 Go to next message
Eclipse UserFriend
Hello.

In my OSGi based application, I would like to apply the pattern of a last ditch "catch all" Exception handler which appropriately and gracefully handles any really unexpected exception that may be thrown and not caught anywhere.

In a normal Java application, I would implement such a patter in the app's main() method. Since an OSGi application does not have such a thing as a main() method, how would I go about doing this?

Any suggestions would be very appreciated.

TIA,
B.
Re: How to implement catch all type exception handler [message #695784 is a reply to message #695771] Tue, 12 July 2011 10:42 Go to previous messageGo to next message
Eclipse UserFriend
I think a nice solution would require some support in Virgo. Virgo would probably need to set an uncaught exception handler on threads that can run application code. I think it could probably manage that before calling Bundle.start and in the executor which is used to spawn Spring DM worker threads. Then Virgo could generate a dump whenever an uncaught exception surfaced. Your "last ditch" bundle could then register a DumpContributor and hook in to the generation of the dump. It would be able to gather additional diagnostics and include them in the dump directory, for instance. The bundle could potentially do some application specific clean up, but I'm not sure it could be made as graceful as you would like.

If that sounds useful, please raise an enhancement bugzilla. If you can provide a patch too, so much the better.

Meanwhile, you could set an uncaught exception handler from your application, but there might be issues getting this to work nicely across bundles, although I can't think of any such issues immediately.

Alternatively, you'd need to make any external "entry point" in a bundle handle its own graceful cleanup before "percolating" the unexpected exception to its caller.
Re: How to implement catch all type exception handler [message #696062 is a reply to message #695784] Wed, 13 July 2011 03:47 Go to previous messageGo to next message
Eclipse UserFriend
Glyn,

the solution that involves Virgo sounds quite neat, I will raise a Bugzilla.

Thanks!

Re: How to implement catch all type exception handler [message #733719 is a reply to message #696062] Wed, 05 October 2011 10:05 Go to previous message
Eclipse UserFriend
Hi together!

Could you please post the link to the raised bug in bugzilla?

Thanks in advance!
Previous Topic:Virgo Experience Report
Next Topic:tomcat authentication
Goto Forum:
  


Current Time: Fri Jul 04 07:17:56 EDT 2025

Powered by FUDForum. Page generated in 1.14262 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top