phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mujt...@apache.org
Subject git commit: PHOENIX-1104 Do not shutdown threadpool when initialization fails
Date Tue, 22 Jul 2014 02:41:16 GMT
Repository: phoenix
Updated Branches:
  refs/heads/3.0 ae4799626 -> 46ee62e2e


PHOENIX-1104 Do not shutdown threadpool when initialization fails


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

Branch: refs/heads/3.0
Commit: 46ee62e2e56efc0f93b310975ee449d8a3396289
Parents: ae47996
Author: Mujtaba <mujtaba@apache.org>
Authored: Mon Jul 21 19:36:06 2014 -0700
Committer: Mujtaba <mujtaba@apache.org>
Committed: Mon Jul 21 19:36:06 2014 -0700

----------------------------------------------------------------------
 .../org/apache/phoenix/jdbc/PhoenixDriver.java  | 29 ++++++++++++--------
 .../phoenix/query/BaseQueryServicesImpl.java    |  1 -
 2 files changed, 17 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/46ee62e2/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
index 3df23a6..b305d8f 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java
@@ -23,6 +23,7 @@ import java.util.Collection;
 import java.util.Properties;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutorService;
 
 import org.apache.phoenix.query.ConnectionQueryServices;
 import org.apache.phoenix.query.ConnectionQueryServicesImpl;
@@ -167,21 +168,25 @@ public final class PhoenixDriver extends PhoenixEmbeddedDriver {
             return;
         }
         closed = true;
-        Collection<ConnectionQueryServices> connectionQueryServices = connectionQueryServicesMap.values();
-        if (!connectionQueryServices.isEmpty()) {
-            try {
+        try {
+            Collection<ConnectionQueryServices> connectionQueryServices = connectionQueryServicesMap.values();
+             try {
+                SQLCloseables.closeAll(connectionQueryServices);
+            } finally {
+                connectionQueryServices.clear();
+            }
+        } finally {
+            if (services != null) {
                 try {
-                    SQLCloseables.closeAll(connectionQueryServices);
-                } finally {
-                    // We know there's a services object if any connections were made
                     services.close();
+                } finally {
+                    ExecutorService executor = services.getExecutor();
+                    // Even if something wrong happened while closing services above, we
still
+                    // want to set it to null. Otherwise, we will end up having a possibly
non-working
+                    // services instance. 
+                    services = null;
+                    executor.shutdown();
                 }
-            } finally {
-                //even if something wrong happened while closing services above, we still
-                //want to set it to null. Otherwise, we will end up having a possibly non-working
-                //services instance. 
-                services = null;
-                connectionQueryServices.clear();
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/46ee62e2/phoenix-core/src/main/java/org/apache/phoenix/query/BaseQueryServicesImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/BaseQueryServicesImpl.java
b/phoenix-core/src/main/java/org/apache/phoenix/query/BaseQueryServicesImpl.java
index 10e562b..1e8fec7 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/BaseQueryServicesImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/BaseQueryServicesImpl.java
@@ -69,7 +69,6 @@ public abstract class BaseQueryServicesImpl implements QueryServices {
 
     @Override
     public void close() {
-        executor.shutdown();
     }
 
     @Override


Mime
View raw message