Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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
Barbara Rosi-Schwartz is currently offline Barbara Rosi-Schwartz
Messages: 448
Registered: July 2009
Senior Member
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
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
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
Barbara Rosi-Schwartz is currently offline Barbara Rosi-Schwartz
Messages: 448
Registered: July 2009
Senior Member
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
Rico Besson is currently offline Rico Besson
Messages: 3
Registered: July 2009
Junior Member
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: Tue Sep 02 03:03:38 EDT 2014

Powered by FUDForum. Page generated in 0.09482 seconds