Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.0 c48dc0c5a -> 1271845cb


PHOENIX-2427 Simplify shutdown hook which causes phoenix-pig tests to timeout


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

Branch: refs/heads/4.x-HBase-1.0
Commit: 1271845cbd93a1bfaf6497c683db8135e7a6e052
Parents: c48dc0c
Author: James Taylor <[email protected]>
Authored: Wed Nov 18 17:23:55 2015 -0800
Committer: James Taylor <[email protected]>
Committed: Wed Nov 18 17:28:07 2015 -0800

----------------------------------------------------------------------
 .../org/apache/phoenix/jdbc/PhoenixDriver.java  | 41 ++++----------------
 1 file changed, 7 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1271845c/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 cfabe82..1a785a6 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
@@ -20,11 +20,9 @@ package org.apache.phoenix.jdbc;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
-import java.util.Collection;
 import java.util.Properties;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ExecutorService;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
@@ -35,7 +33,6 @@ import org.apache.phoenix.query.ConnectionQueryServicesImpl;
 import org.apache.phoenix.query.ConnectionlessQueryServicesImpl;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesImpl;
-import org.apache.phoenix.util.SQLCloseables;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -184,20 +181,10 @@ public final class PhoenixDriver extends 
PhoenixEmbeddedDriver {
             }
             finally {
                 if (!success) {
-                    try {
-                        connectionQueryServices.close();
-                    } catch (SQLException e) {
-                        if (sqlE == null) {
-                            sqlE = e;
-                        } else {
-                            sqlE.setNextException(e);
-                        }
-                    } finally {
-                        // Remove from map, as initialization failed
-                        connectionQueryServicesMap.remove(normalizedConnInfo);
-                        if (sqlE != null) {
-                            throw sqlE;
-                        }
+                    // Remove from map, as initialization failed
+                    connectionQueryServicesMap.remove(normalizedConnInfo);
+                    if (sqlE != null) {
+                        throw sqlE;
                     }
                 }
             }
@@ -229,25 +216,11 @@ public final class PhoenixDriver extends 
PhoenixEmbeddedDriver {
             closeLock.writeLock().unlock();
         }
 
-        try {
-            Collection<ConnectionQueryServices> connectionQueryServices = 
connectionQueryServicesMap.values();
+        if (services != null) {
             try {
-                SQLCloseables.closeAll(connectionQueryServices);
+                services.close();
             } finally {
-                connectionQueryServices.clear();
-            }
-        } finally {
-            if (services != null) {
-                try {
-                    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();
-                }
+                services = null;
             }
         }
     }

Reply via email to