Skip to content

Commit 91f57a1

Browse files
committed
chore: cleanup flightStream ledger of FlightSqlClient close.
1 parent 5f2328b commit 91f57a1

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/main/java/com/influxdb/v3/client/internal/FlightSqlClient.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ private synchronized void addToAutoCloseable(@Nonnull final AutoCloseable closea
170170
public void close() throws Exception {
171171
autoCloseables.add(client);
172172
AutoCloseables.close(autoCloseables);
173+
for (AutoCloseable closeable : autoCloseables) {
174+
CLOSEABLE_CLOSED_LEDGER.remove(closeable);
175+
}
173176
}
174177

175178
@Nonnull

src/test/java/com/influxdb/v3/client/internal/FlightSqlClientTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,11 @@ public void multipleFlightStreamsFreed() throws Exception {
405405
Assertions.assertThat(flightSqlClient.autoCloseables.contains(autoCloseables.get(i))).isTrue();
406406
}
407407
}
408+
Assertions.assertThat(FlightSqlClient.CLOSEABLE_CLOSED_LEDGER.size())
409+
.isEqualTo(FlightSqlClient.AUTOCLOSEABLE_CHECK_LIMIT - 1);
408410
}
411+
Assertions.assertThat(FlightSqlClient.CLOSEABLE_CLOSED_LEDGER.size()).isEqualTo(0);
412+
409413
}
410414

411415
static class HeaderCaptureMiddleware implements FlightServerMiddleware {

0 commit comments

Comments
 (0)