phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tdsi...@apache.org
Subject [1/3] phoenix git commit: PHOENIX-2427 Simplify shutdown hook which causes phoenix-pig tests to timeout
Date Thu, 19 Nov 2015 03:52:05 GMT
Repository: phoenix
Updated Branches:
  refs/heads/txn 0d02b963d -> 0a9561172


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/f31ece1d
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/f31ece1d
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/f31ece1d

Branch: refs/heads/txn
Commit: f31ece1dce93d1513804afa0399258c6848e9d3c
Parents: 27a152e
Author: James Taylor <jamestaylor@apache.org>
Authored: Wed Nov 18 17:23:55 2015 -0800
Committer: James Taylor <jamestaylor@apache.org>
Committed: Wed Nov 18 17:23:55 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/f31ece1d/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;
             }
         }
     }


Mime
View raw message