Skip to content

Conversation

github-actions[bot]
Copy link

@github-actions github-actions bot commented Sep 7, 2025

What changes were proposed in this pull request?

Add a null check before shutting down scheduledExecutorService in close method.

Why are the changes needed?

clientPoolCache is a static field, meaning it is shared across all instances of IcebergHiveCachedClientPool.
Only the first instance that calls init() will initialize both clientPoolCache and scheduledExecutorService.
Any subsequent instances will find clientPoolCache already initialized, so they will not initialize scheduledExecutorService (it remains null for those instances).When we create multiple instances of IcebergHiveCachedClientPool, only the first instance will have a non-null scheduledExecutorService.The other instances will have scheduledExecutorService as null.
When we call close() on all instances, each will attempt to call scheduledExecutorService.shutdownNow()
For instances where scheduledExecutorService is null, this results in a NullPointerException.

Fix: (#8382 )

Does this PR introduce any user-facing change?

No

How was this patch tested?

unit testing

…rgHiveCachedClientPool when closing multiple instances (#8455)

<!--
1. Title: [#<issue>] <type>(<scope>): <subject>
   Examples:
     - "[#123] feat(operator): support xxx"
     - "[#233] fix: check null before access result in xxx"
     - "[MINOR] refactor: fix typo in variable name"
     - "[MINOR] docs: fix typo in README"
     - "[#255] test: fix flaky test NameOfTheTest"
   Reference: https://www.conventionalcommits.org/en/v1.0.0/
2. If the PR is unfinished, please mark this PR as draft.
-->

### What changes were proposed in this pull request?
Add a null check before shutting down scheduledExecutorService in close
method.


### Why are the changes needed?
clientPoolCache is a static field, meaning it is shared across all
instances of IcebergHiveCachedClientPool.
Only the first instance that calls init() will initialize both
clientPoolCache and scheduledExecutorService.
Any subsequent instances will find clientPoolCache already initialized,
so they will not initialize scheduledExecutorService (it remains null
for those instances).When we create multiple instances of
IcebergHiveCachedClientPool, only the first instance will have a
non-null scheduledExecutorService.The other instances will have
scheduledExecutorService as null.
When we call close() on all instances, each will attempt to call
scheduledExecutorService.shutdownNow()
For instances where scheduledExecutorService is null, this results in a
NullPointerException.

Fix: (#8382 )

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
unit testing
@github-actions github-actions bot requested a review from jerryshao September 7, 2025 12:13
@yuqi1129 yuqi1129 closed this Sep 7, 2025
@yuqi1129 yuqi1129 reopened this Sep 7, 2025
@yuqi1129 yuqi1129 merged commit dfbe36e into branch-1.0 Sep 7, 2025
28 checks passed
@yuqi1129 yuqi1129 deleted the cherry-pick-branch-1.0-36024acd06c179a7c6029383b1f065edbd78d6f7 branch September 7, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants