|
74 | 74 | final class FlightSqlClient implements AutoCloseable { |
75 | 75 |
|
76 | 76 | private static final Logger LOG = LoggerFactory.getLogger(FlightSqlClient.class); |
77 | | - private static int AUTOCLOSEABLE_CHECK_LIMIT = 10; |
78 | | - private static Map<AutoCloseable, Boolean> CLOSEABLE_CLOSED_LEDGER = new ConcurrentHashMap<>(); |
| 77 | + private static final int AUTOCLOSEABLE_CHECK_LIMIT = 10; |
| 78 | + private static final Map<AutoCloseable, Boolean> CLOSEABLE_CLOSED_LEDGER = new ConcurrentHashMap<>(); |
79 | 79 |
|
80 | 80 | private final FlightClient client; |
81 | 81 |
|
@@ -144,16 +144,16 @@ Stream<VectorSchemaRoot> execute(@Nonnull final String query, |
144 | 144 | return StreamSupport.stream(spliterator, false).onClose(iterator::close); |
145 | 145 | } |
146 | 146 |
|
147 | | - private void addToAutoCloseable(AutoCloseable closeable) { |
| 147 | + private void addToAutoCloseable(@Nonnull final AutoCloseable closeable) { |
148 | 148 | // need to occasionally clean up references to closed streams |
149 | 149 | // in order to ensure memory can get freed. |
150 | | - if(autoCloseables.size() > AUTOCLOSEABLE_CHECK_LIMIT) { |
| 150 | + if (autoCloseables.size() > AUTOCLOSEABLE_CHECK_LIMIT) { |
151 | 151 | LOG.info("checking to cleanup stale flight streams from {} known streams", autoCloseables.size()); |
152 | 152 |
|
153 | 153 | ListIterator<AutoCloseable> iter = autoCloseables.listIterator(); |
154 | | - while(iter.hasNext()){ |
| 154 | + while (iter.hasNext()) { |
155 | 155 | AutoCloseable autoCloseable = iter.next(); |
156 | | - if(CLOSEABLE_CLOSED_LEDGER.get(autoCloseable)){ |
| 156 | + if (CLOSEABLE_CLOSED_LEDGER.get(autoCloseable)) { |
157 | 157 | LOG.info("removing closed stream {}", autoCloseable); |
158 | 158 | CLOSEABLE_CLOSED_LEDGER.keySet().remove(autoCloseable); |
159 | 159 | iter.remove(); |
|
0 commit comments