Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 51ce75c77 -> f3a524258


PHOENIX-4041 CoprocessorHConnectionTableFactory should not open a new 
HConnection when shutting down


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/f3a52425
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/f3a52425
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/f3a52425

Branch: refs/heads/4.x-HBase-1.2
Commit: f3a5242585be71b8bbe37dab1b3b65e9aab8fa7d
Parents: 51ce75c
Author: Samarth Jain <[email protected]>
Authored: Wed Jul 19 11:47:09 2017 -0700
Committer: Samarth Jain <[email protected]>
Committed: Wed Jul 19 11:47:09 2017 -0700

----------------------------------------------------------------------
 .../phoenix/hbase/index/write/IndexWriterUtils.java       | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f3a52425/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
index f2885a9..3649069 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/IndexWriterUtils.java
@@ -132,11 +132,13 @@ public class IndexWriterUtils {
         }
 
         @Override
-        public void shutdown() {
+        public synchronized void shutdown() {
             try {
-                getConnection(conf).close();
-            } catch (IOException e) {
-                LOG.error("Exception caught while trying to close the 
HConnection used by CoprocessorHConnectionTableFactory");
+                if (connection != null && !connection.isClosed()) {
+                    connection.close();
+                }
+            } catch (Throwable e) {
+                LOG.warn("Error while trying to close the HConnection used by 
CoprocessorHConnectionTableFactory", e);
             }
         }
 

Reply via email to