4 ms·
I was thinking the same thing, but replace your finally block with, Util.dispose(x,y); ...and let that handle all the possible issues.
by mynameishere 16y ago
I was thinking the same thing, but replace your finally block with,
Util.dispose(x,y);
...and let that handle all the possible issues.
- reverend_gonzo 16y agoI've taken Groovy's with... syntax and built utils that are ie: public void withConnection(Callback<Connection> callback) { Connection connection = createConnection(); try { callback.call(connection); } finally { connection.dispose(); } } Once Java actually gets closures it'll make this soooo much nicer.