Correctly close flatfile database connections on disable, catch all exceptions when performing initial data load
This commit is contained in:
+3
-3
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -42,6 +42,10 @@ public final class NonClosableConnection implements Connection {
|
||||
|
||||
}
|
||||
|
||||
public void shutdown() throws SQLException {
|
||||
delegate.close();
|
||||
}
|
||||
|
||||
private interface Exclude {
|
||||
void close() throws SQLException;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user