You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ja...@apache.org on 2014/03/16 20:04:26 UTC
[1/2] git commit: PHOENX-856 Allow phoenix driver reuse after being
closed (BrunoDumon)
Repository: incubator-phoenix
Updated Branches:
refs/heads/3.0 ed9f58bae -> 6faf0ca64
PHOENX-856 Allow phoenix driver reuse after being closed (BrunoDumon)
Project: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/commit/7c33852a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/tree/7c33852a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/diff/7c33852a
Branch: refs/heads/3.0
Commit: 7c33852a9bb3ba90e44d4f004a8c9af6d5f0afdd
Parents: ed9f58b
Author: James Taylor <ja...@apache.org>
Authored: Sun Mar 16 12:00:41 2014 -0700
Committer: James Taylor <ja...@apache.org>
Committed: Sun Mar 16 12:00:41 2014 -0700
----------------------------------------------------------------------
.../org/apache/phoenix/jdbc/PhoenixDriver.java | 38 ++++++++++++++------
1 file changed, 27 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/7c33852a/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 6660124..44d54fb 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
@@ -67,7 +67,7 @@ public final class PhoenixDriver extends PhoenixEmbeddedDriver {
}
});
} catch (SQLException e) {
- throw new IllegalStateException("Untable to register " + PhoenixDriver.class.getName() + ": "+ e.getMessage());
+ throw new IllegalStateException("Unable to register " + PhoenixDriver.class.getName() + ": "+ e.getMessage());
}
}
// One entry per cluster here
@@ -79,10 +79,13 @@ public final class PhoenixDriver extends PhoenixEmbeddedDriver {
}
private volatile QueryServices services;
+ private volatile boolean closed = false;
@Override
public QueryServices getQueryServices() {
- // Lazy initialize QueryServices so that we only attempt to create an HBase Configuration
+ checkClosed();
+
+ // Lazy initialize QueryServices so that we only attempt to create an HBase Configuration
// object upon the first attempt to connect to any cluster. Otherwise, an attempt will be
// made at driver initialization time which is too early for some systems.
QueryServices result = services;
@@ -105,6 +108,8 @@ public final class PhoenixDriver extends PhoenixEmbeddedDriver {
@Override
protected ConnectionQueryServices getConnectionQueryServices(String url, Properties info) throws SQLException {
+ checkClosed();
+
ConnectionInfo connInfo = ConnectionInfo.create(url);
ConnectionInfo normalizedConnInfo = connInfo.normalize(getQueryServices().getProps());
ConnectionQueryServices connectionQueryServices = connectionQueryServicesMap.get(normalizedConnInfo);
@@ -123,20 +128,31 @@ public final class PhoenixDriver extends PhoenixEmbeddedDriver {
return connectionQueryServices;
}
+ private void checkClosed() {
+ if (closed) {
+ throw new IllegalStateException("The Phoenix jdbc driver has been closed.");
+ }
+ }
+
@Override
- public void close() throws SQLException {
+ public synchronized void close() throws SQLException {
+ if (closed) {
+ return;
+ }
+ closed = true;
Collection<ConnectionQueryServices> connectionQueryServices = connectionQueryServicesMap.values();
- if (!connectionQueryServices.isEmpty()) {
+ if (!connectionQueryServices.isEmpty()) {
+ try {
try {
- try {
- SQLCloseables.closeAll(connectionQueryServices);
- } finally {
- // We know there's a services object if any connections were made
- services.getExecutor().shutdownNow();
- }
+ SQLCloseables.closeAll(connectionQueryServices);
} finally {
- connectionQueryServices.clear();
+ // We know there's a services object if any connections were made
+ services.getExecutor().shutdownNow();
}
+ } finally {
+ connectionQueryServices.clear();
}
+ }
+ services = null;
}
}
[2/2] git commit: PHOENIX-857 Duplicate dependency on phoenix-core in
phoenix-flume (GabrielReid)
Posted by ja...@apache.org.
PHOENIX-857 Duplicate dependency on phoenix-core in phoenix-flume (GabrielReid)
Project: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/commit/6faf0ca6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/tree/6faf0ca6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/diff/6faf0ca6
Branch: refs/heads/3.0
Commit: 6faf0ca64e7aac2e034019ec09646ff4b490ea6a
Parents: 7c33852
Author: James Taylor <ja...@apache.org>
Authored: Sun Mar 16 12:04:09 2014 -0700
Committer: James Taylor <ja...@apache.org>
Committed: Sun Mar 16 12:04:09 2014 -0700
----------------------------------------------------------------------
phoenix-flume/pom.xml | 4 ----
1 file changed, 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/6faf0ca6/phoenix-flume/pom.xml
----------------------------------------------------------------------
diff --git a/phoenix-flume/pom.xml b/phoenix-flume/pom.xml
index 022d39d..8adde9c 100644
--- a/phoenix-flume/pom.xml
+++ b/phoenix-flume/pom.xml
@@ -36,10 +36,6 @@
<groupId>org.apache.phoenix</groupId>
<artifactId>phoenix-core</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.phoenix</groupId>
- <artifactId>phoenix-core</artifactId>
- </dependency>
<dependency>
<groupId>org.apache.phoenix</groupId>
<artifactId>phoenix-core</artifactId>