Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.0-beta-3, 1.8.7
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
It would be useful to have variations of some of the groovy.sql.Sql#newInstance methods which took care of resource management, e.g. instead of this:
def sql try { sql = Sql.newInstance(db.url, db.user, db.password, db.driver) // sql operations here } finally { sql?.close() }
You could do something like:
Sql.withInstance(db.url, db.user, db.password, db.driver) { sql ->
// sql operations here
}
Activity
Paul King
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Assignee | Paul King [ paulk ] | |
| Fix Version/s | 2.0-beta-3 [ 18244 ] | |
| Fix Version/s | 1.8.7 [ 18317 ] | |
| Resolution | Fixed [ 1 ] |
Russel Winder
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |
Isn't this something that should be handles using "try with resources" aka automated resource management (ARM) which came in new with Java 7?