lidavidm commented on code in PR #35603:
URL: https://github.com/apache/arrow/pull/35603#discussion_r1283201834
##########
java/flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/ArrowFlightJdbcFlightStreamResultSet.java:
##########
@@ -99,23 +136,33 @@ static ArrowFlightJdbcFlightStreamResultSet fromFlightInfo(
final ArrowFlightJdbcFlightStreamResultSet resultSet =
new ArrowFlightJdbcFlightStreamResultSet(connection, state, signature,
resultSetMetaData,
timeZone, null);
-
resultSet.transformer = transformer;
resultSet.execute(flightInfo);
return resultSet;
}
- private void loadNewQueue() {
-
Optional.ofNullable(flightStreamQueue).ifPresent(AutoCloseables::closeNoChecked);
- flightStreamQueue = createNewQueue(connection.getExecutorService());
+ /**
+ * Gets the Blocking Queue Capacity from {@link ArrowFlightConnection}
properties.
+ *
+ * @return Blocking Queue Capacity set or Default Blocking Queue Capacity
+ * @throws SQLException for Invalid Blocking Queue Capacity set
+ */
+ private int getBlockingQueueCapacity() throws SQLException {
+ try {
+ return
ofNullable(connection.getClientInfo().getProperty(BLOCKING_QUEUE_PARAM))
+ .map(Integer::parseInt)
+ .filter(s -> s > 0)
+ .orElse(DEFAULT_BLOCKING_QUEUE_CAPACITY);
+ } catch (java.lang.NumberFormatException e) {
+ throw new SQLException("Invalid value for 'buffersize' was provided", e);
+ }
}
- private void loadNewFlightStream() throws SQLException {
- if (currentFlightStream != null) {
- AutoCloseables.closeNoChecked(currentFlightStream);
+ private void initializeVectorSchemaRootsQueue(int blockingQueueCapacity) {
+ if (vectorSchemaRoots == null) {
+ vectorSchemaRoots = new LinkedBlockingQueue<>(blockingQueueCapacity);
}
- this.currentFlightStream = getNextFlightStream(true);
}
Review Comment:
Does this really need to be a separate method? It can just be inlined into
the constructor. (Also, won't vectorSchemaRoots always be null to start with?
If we initialize it in the constructor, we can make it final too.)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]