amoeba commented on code in PR #4441:
URL: https://github.com/apache/arrow-adbc/pull/4441#discussion_r3475855363
##########
java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/JniConnection.java:
##########
@@ -267,17 +285,26 @@ public ArrowReader getStatistics(
return JniLoader.INSTANCE
.connectionGetStatistics(
handle, catalogPattern, dbSchemaPattern, tableNamePattern,
approximate)
- .importStream(allocator);
+ .importStream(allocator, this);
}
@Override
public ArrowReader getStatisticNames() throws AdbcException {
- return
JniLoader.INSTANCE.connectionGetStatisticNames(handle).importStream(allocator);
+ return
JniLoader.INSTANCE.connectionGetStatisticNames(handle).importStream(allocator,
this);
}
@Override
- public void close() {
- handle.close();
+ public void close() throws AdbcException {
+ try {
+ AutoCloseables.close(childReferences, handle);
+ } catch (Exception e) {
+ throw AdbcException.internal("[jni] failed to close
connection").withCause(e);
+ }
+ final var parent = this.parent;
+ if (parent != null) {
+ parent.getChildReferences().releaseReference(this);
+ this.parent = null;
+ }
Review Comment:
Should this and other similar blocks be in a finally so the child always
gets detached? Just curious.
--
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]