The Artima Developer Community
Sponsored Link

Legacy Design Forum
Finalization and Cleanup

Advertisement

Advertisement

This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

try/finally and if blocks in finalize

Posted by Martin Heitz on August 01, 2000 at 5:21 AM

Hi,

isn't in approach 2 and 3 super.finalize() called only in those cases, when the log file is assumed to be open?
Shouldn't the code be
protected void finalize() throws Throwable {
try {
if (logFileOpen) {
closeLogFile();
}
} finally {
super.finalize();
}
}



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us