tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject tajo git commit: TAJO-1619: JDBC program is stuck after closing. (jihoon)
Date Tue, 26 May 2015 07:13:37 GMT
Repository: tajo
Updated Branches:
  refs/heads/branch-0.10.1 c97e200bf -> 985f61d6b


TAJO-1619: JDBC program is stuck after closing. (jihoon)


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

Branch: refs/heads/branch-0.10.1
Commit: 985f61d6b1c71a7b261a5f91496fde104b61d708
Parents: c97e200
Author: Jihoon Son <jihoonson@apache.org>
Authored: Tue May 26 16:13:28 2015 +0900
Committer: Jihoon Son <jihoonson@apache.org>
Committed: Tue May 26 16:13:28 2015 +0900

----------------------------------------------------------------------
 CHANGES                                               |  2 ++
 .../org/apache/tajo/client/SessionConnection.java     | 14 ++++++++++++++
 2 files changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/985f61d6/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 50b735c..5baaa53 100644
--- a/CHANGES
+++ b/CHANGES
@@ -40,6 +40,8 @@ Release 0.10.1 - unreleased
 
   BUG FIXES
 
+    TAJO-1619: JDBC program is stuck after closing. (jihoon)
+
     TAJO-1612: TestKillQuery occassionally fails. (hyunsik)
 
     TAJO-1440: Some tests fail in parallel test environment in TestKillQuery.

http://git-wip-us.apache.org/repos/asf/tajo/blob/985f61d6/tajo-client/src/main/java/org/apache/tajo/client/SessionConnection.java
----------------------------------------------------------------------
diff --git a/tajo-client/src/main/java/org/apache/tajo/client/SessionConnection.java b/tajo-client/src/main/java/org/apache/tajo/client/SessionConnection.java
index b0cc662..187af33 100644
--- a/tajo-client/src/main/java/org/apache/tajo/client/SessionConnection.java
+++ b/tajo-client/src/main/java/org/apache/tajo/client/SessionConnection.java
@@ -30,9 +30,11 @@ import org.apache.tajo.ipc.ClientProtos.ResultCode;
 import org.apache.tajo.ipc.ClientProtos.SessionUpdateResponse;
 import org.apache.tajo.ipc.TajoMasterClientProtocol;
 import org.apache.tajo.rpc.NettyClientBase;
+import org.apache.tajo.rpc.RpcChannelFactory;
 import org.apache.tajo.rpc.RpcClientManager;
 import org.apache.tajo.rpc.ServerCallable;
 import org.apache.tajo.service.ServiceTracker;
+import org.apache.tajo.util.CommonTestingUtil;
 import org.apache.tajo.util.KeyValueSet;
 import org.apache.tajo.util.ProtoUtil;
 
@@ -46,6 +48,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import static org.apache.tajo.ipc.ClientProtos.CreateSessionRequest;
 import static org.apache.tajo.ipc.ClientProtos.CreateSessionResponse;
@@ -55,6 +58,8 @@ public class SessionConnection implements Closeable {
 
   private final Log LOG = LogFactory.getLog(TajoClientImpl.class);
 
+  private final static AtomicInteger connections = new AtomicInteger();
+
   final RpcClientManager manager;
 
   private final String baseDatabase;
@@ -91,6 +96,7 @@ public class SessionConnection implements Closeable {
     this.baseDatabase = baseDatabase != null ? baseDatabase : null;
 
     this.serviceTracker = tracker;
+    connections.incrementAndGet();
   }
 
   public Map<String, String> getClientSideSessionVars() {
@@ -287,6 +293,14 @@ public class SessionConnection implements Closeable {
       // ignore
     } finally {
       RpcClientManager.cleanup(client);
+      if(connections.decrementAndGet() == 0) {
+        if (!System.getProperty(CommonTestingUtil.TAJO_TEST_KEY, "FALSE").equals(CommonTestingUtil.TAJO_TEST_TRUE))
{
+          RpcChannelFactory.shutdownGracefully();
+          if (LOG.isDebugEnabled()) {
+            LOG.debug("RPC connection is closed");
+          }
+        }
+      }
     }
   }
 


Mime
View raw message