Skip to content

Conversation

@nastra
Copy link
Contributor

@nastra nastra commented Jun 15, 2022

No description provided.

@nastra nastra requested a review from RussellSpitzer June 15, 2022 11:41
public void close() {
client.close();
public void close() throws IOException {
if (null != closeableGroup) {
Copy link
Member

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.

Copy link
Contributor Author

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should just be client?

Copy link
Contributor Author

@nastra nastra Jun 15, 2022

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

@nastra nastra force-pushed the nessie-close-resources branch from 2bea794 to 2dc5455 Compare June 15, 2022 15:21
Copy link
Member

@RussellSpitzer RussellSpitzer left a 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

@RussellSpitzer RussellSpitzer merged commit 8d8b606 into apache:master Jun 15, 2022
namrathamyske pushed a commit to namrathamyske/iceberg that referenced this pull request Jul 10, 2022
namrathamyske pushed a commit to namrathamyske/iceberg that referenced this pull request Jul 10, 2022
@nastra nastra deleted the nessie-close-resources branch September 27, 2022 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants