We have a rather large and complex application written in Java which is running on top of the Gridgain package. The problem I am having is that this application will sit there p
Finalizers can't be relied on to be called. It's not a good approach for resource management. The standard construct in Java for this is:
InputStream in = null;
try {
in = ...;
// do stuff
} catch (IOException e) {
// error
} finally {
if (in != null) { try { in.close(); } catch (Exception e) { } }
in = null;
}
You may want to wrap these handles inside a class but that's not a robust approach.