taklwu commented on a change in pull request #3696:
URL: https://github.com/apache/hbase/pull/3696#discussion_r715144046
##########
File path:
hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java
##########
@@ -2104,28 +2107,32 @@ public boolean isAborted(){
@Override
public void close() {
- if (this.closed) {
- return;
- }
- closeMaster();
- shutdownPools();
- if (this.metrics != null) {
- this.metrics.shutdown();
- }
- this.closed = true;
- if (this.registry != null) {
- registry.close();
- }
- this.stubs.clear();
- if (clusterStatusListener != null) {
- clusterStatusListener.close();
- }
- if (rpcClient != null) {
- rpcClient.close();
- }
- if (choreService != null) {
- choreService.shutdown();
- }
+ TraceUtil.trace(() -> {
+ if (this.closed) {
+ return;
+ }
+ closeMaster();
+ shutdownPools();
+ if (this.metrics != null) {
+ this.metrics.shutdown();
+ }
+ this.closed = true;
+ if (this.registry != null) {
+ registry.close();
+ }
+ this.stubs.clear();
+ if (clusterStatusListener != null) {
+ clusterStatusListener.close();
+ }
+ if (rpcClient != null) {
+ rpcClient.close();
+ }
+ synchronized (this) {
Review comment:
this fix the error of [spotbugs
report](https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3696/2/artifact/yetus-general-check/output/new-spotbugs-hbase-client.html)
during one of the precommit checks
```
Bug type IS2_INCONSISTENT_SYNC (click for details)
In class org.apache.hadoop.hbase.client.ConnectionImplementation
Field org.apache.hadoop.hbase.client.ConnectionImplementation.choreService
Synchronized 50% of the time
Unsynchronized access at ConnectionImplementation.java:[line 2131]
Unsynchronized access at ConnectionImplementation.java:[line 2132]
Synchronized access at ConnectionImplementation.java:[line 617]
Synchronized access at ConnectionImplementation.java:[line 620]
Synchronized access at ConnectionImplementation.java:[line 618]
```
--
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]