Correctly close flatfile database connections on disable, catch all exceptions when performing initial data load

This commit is contained in:
Luck
2017-12-22 22:35:13 +00:00
Unverified
parent cc3ddd51fd
commit 0b72507e2d
5 changed files with 24 additions and 6 deletions
@@ -39,7 +39,7 @@ abstract class FlatfileConnectionFactory extends AbstractConnectionFactory {
protected final File file;
private final ReentrantLock lock = new ReentrantLock();
private Connection connection;
private NonClosableConnection connection;
FlatfileConnectionFactory(String name, File file) {
super(name);
@@ -56,8 +56,8 @@ abstract class FlatfileConnectionFactory extends AbstractConnectionFactory {
@Override
public void shutdown() throws Exception {
if (connection != null && !connection.isClosed()) {
connection.close();
if (connection != null) {
connection.shutdown();
}
}
@@ -42,6 +42,10 @@ public final class NonClosableConnection implements Connection {
}
public void shutdown() throws SQLException {
delegate.close();
}
private interface Exclude {
void close() throws SQLException;
}