Tuesday, September 30, 2008

Wrap finalizer code in appropriate try-catch block

What would happen if the finalizer thread encounters an unhandled exception? Predict the output of the below program:

An unhandled exception on the finalizer thread brings the complete process down. Consider wrapping the finalizer code into an appropriate try-catch block and let only the unavoidable exceptions to escape and bring the process down.