Blogs : Latest entries
|
|
| < Previous page |
|
It's been a while since I wrote some raw JDBC code. I didn't remember that it was so tedious to manually close a series of Note that the ARM blocks or BGGA closures proposals don't make this easier since this cleanup should be done after the prepared statements have been used for a while in various other methods, it doesn't automatically have to be done at the end of a lexical scope. This is what I came up with. Of course, you could write an alternative implementation that creates some kind of repository for the prepared statements in a map and then provide a method that closes them all by going over the entries of the map while preserving the exceptions in a similar manner. Any other suggestions or comments for this to be done better?
private PreparedStatement psStmt1;
private PreparedStatement psStmt2;
private PreparedStatement psStmt3;
public void cleanup() throws SQLException {
SQLException exception = null;
if (psStmt1 != null) {
try {
psStmt1.close();
} catch (SQLException e) {
exception = e;
} finally {
psStmt1 = null;
}
}
if (psStmt2 != null) {
try {
psStmt2.close();
} catch (SQLException e) {
if (exception != null) e.setNextException(exception);
exception = e;
} finally {
psStmt2 = null;
}
}
if (psStmt3 != null) {
try {
psStmt3.close();
} catch (SQLException e) {
if (exception != null) e.setNextException(exception);
exception = e;
} finally {
psStmt3 = null;
}
}
if (exception != null) {
throw exception;
}
} |
|
At JavaPolis 2007, Aaron Houston the coordinator of the Sun Java Champions program, recorded a whole collection of short interviews with the Java Champions that were present at the conference (2-8 mins). If you're wondering what the Java Champions are up to, or even who or what they are, this is a easy and quick way to find out. The interviews can be found on the Java Champions homepage and will eventually move to the library section. You can listen to my interview directly here (6 min 12 MB): https://java-champions.dev.java.net/mp3/JP07-geert-bevin.mp3 |
|
The Java Champions program has already opened many doors for me and today an interview that Steven Meloan took with me has been published on the Sun Developer Network. I would never have dreamed of this a year ago, these are very exciting times If you're interested, you can read it here. |
|
Yanto says:
"Kito, can I abuse you?" D'oh! |
|
Omnicore recently released the final versions of X-develop 2.0 and CodeGuide 8.0. Since I have been working with both IDEs for quite a number of years, and have been beta testing the early releases of the new version, I wrote a comprehensive review about these tools for TheServerSide. If you're interested in state-of-the-art tools for Java development, you might find this an interesting read. The review is available here. |
| < Previous page |


