Skip to content

Commit 3c2c004

Browse files
committed
Fix memory leak
1 parent 2329174 commit 3c2c004

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/ArrowFlightConnection.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import io.netty.util.concurrent.DefaultThreadFactory;
2222
import java.sql.SQLException;
23+
import java.util.List;
2324
import java.util.Properties;
2425
import java.util.concurrent.ExecutorService;
2526
import java.util.concurrent.Executors;
@@ -180,6 +181,12 @@ public Properties getClientInfo() {
180181

181182
@Override
182183
public void close() throws SQLException {
184+
// Clean up any open Statements
185+
try {
186+
AutoCloseables.close(List.copyOf(statementMap.values()));
187+
} catch (final Exception e) {
188+
throw AvaticaConnection.HELPER.createException(e.getMessage(), e);
189+
}
183190
clientHandler.close();
184191
if (executorService != null) {
185192
executorService.shutdown();

0 commit comments

Comments
 (0)