Skip to content

Commit

Permalink
chimera: on shutdown propagate close to DB specific driver
Browse files Browse the repository at this point in the history
Motivation:
If chimera DB driver is statefull it might require an explicit close on
shutdown.

Modification:
Add FsSqlDriver#close method that is called by JdbcFs#close.

Result:
better handling of db resources.

Acked-by: Paul Millar
Target: master
Require-book: no
Require-notes: no
  • Loading branch information
kofemann committed Jan 27, 2025
1 parent 3b12aa7 commit 76fe850
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
/**
* SQL driver
*/
public class FsSqlDriver {
public class FsSqlDriver implements AutoCloseable {
/**
* Simple class to hold a tag assignment's directory inumber and its value.
*/
Expand Down Expand Up @@ -2436,4 +2436,12 @@ Integer getQoSPolicyId(String name) throws SQLException {
}
return _jdbc.queryForObject("SELECT id FROM t_qos_policy WHERE name=?", Integer.class, name);
}

/**
* Close driver and free DB resources.
*/
@Override
public void close() {
// to be overwritten by subclasses
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1539,6 +1539,7 @@ public String getInfo() {
@Override
public void close() throws IOException {
maintenanceTaskExecutor.shutdown();
_sqlDriver.close();
}

@Override
Expand Down

0 comments on commit 76fe850

Please sign in to comment.