Close StatementClient
@@ -196,8 +196,7 @@ public class BenchmarkQueryRunner
private StatementStats execute(ClientSession session, String query, Consumer<QueryData> queryDataConsumer, Consumer<QueryError> queryErrorConsumer)
{
// start query
- StatementClient client = new StatementClient(okHttpClient, session, query);
-
+ try (StatementClient client = new StatementClient(okHttpClient, session, query)) {
// read query output
while (client.isValid() && client.advance()) {
queryDataConsumer.accept(client.currentData());
@@ -219,6 +218,7 @@ public class BenchmarkQueryRunner
return client.finalStatusInfo().getStats();
}
+ }
@Override
public void close()
