-
Notifications
You must be signed in to change notification settings - Fork 3k
Nessie: Properly close all resources in NessieCatalog #5047
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| public void close() { | ||
| client.close(); | ||
| public void close() throws IOException { | ||
| if (null != closeableGroup) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: do we need this null check? I don't see other catalogs doing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know others don't have it but I feel that we could potentially still run into a case where closeableGroup hasn't been initialized because some preivous code in initialize(...) failed and if close() is called at some place, then it would throw a NPE
| this.catalogOptions = Preconditions.checkNotNull(catalogOptions, "catalogOptions must be non-null"); | ||
| this.warehouseLocation = validateWarehouseLocation(name, catalogOptions); | ||
| this.closeableGroup = new CloseableGroup(); | ||
| closeableGroup.addCloseable(client::close); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should just be client?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the result would be the same but having just client here looks cleaner, so I pushed the change
2bea794 to
2dc5455
Compare
RussellSpitzer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just waiting on tests
No description provided.