Použijte metody vyčištění, která se vyvolá explicitně místo metody finalize().
public void free() {
Connection conn = null;
try {
DataSource ds = getDataSource();
conn = ds.getConnection();
conn.commit();
}
catch (SQLException exc) {
LogUtility.log(exc);
}
finally {
if (conn != null) {
try {
conn.close();
}
catch (SQLException exc) {
LogUtility.log(exc);
}
}
}
}
private DataSource getDataSource() {
return _source;
}
private transient DataSource _source;
|
|