Dispose pattern: Difference between revisions

Content deleted Content added
m Exceptions: wording
m Exceptions: formatting
Line 37:
resource = getResource();
try {
resource2 = getResource();
// Perform actions with the resources.
...
} finally {
// Resource might not have been acquired, or already freed
if (resource2 != null)
resource2.dispose();
}
} finally {