tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hyun...@apache.org
Subject git commit: TAJO-1024: RpcConnectionPool::getConnection can cause NPE at initialization.
Date Mon, 15 Sep 2014 03:25:42 GMT
Repository: tajo
Updated Branches:
  refs/heads/master 3a3850a29 -> e6e164f15


TAJO-1024: RpcConnectionPool::getConnection can cause NPE at initialization.

Closes #139


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

Branch: refs/heads/master
Commit: e6e164f15f485661932e4fb6e866f93a7c2f5935
Parents: 3a3850a
Author: Hyunsik Choi <hyunsik@apache.org>
Authored: Sun Sep 14 22:06:08 2014 +0900
Committer: Hyunsik Choi <hyunsik@apache.org>
Committed: Mon Sep 15 12:24:31 2014 +0900

----------------------------------------------------------------------
 CHANGES                                                      | 3 +++
 .../src/main/java/org/apache/tajo/rpc/RpcConnectionPool.java | 8 ++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/e6e164f1/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index ab72cb4..ef6dc94 100644
--- a/CHANGES
+++ b/CHANGES
@@ -139,6 +139,9 @@ Release 0.9.0 - unreleased
 
   BUG FIXES
 
+    TAJO-1024: RpcConnectionPool::getConnection can cause NPE at 
+    initialization. (hyunsik)
+
     TAJO-1038: Remove use of Builder variable in Schema. (hyunsik)
 
     TAJO-1022: tsql does not work as background process(Hyoungjun Kim)

http://git-wip-us.apache.org/repos/asf/tajo/blob/e6e164f1/tajo-rpc/src/main/java/org/apache/tajo/rpc/RpcConnectionPool.java
----------------------------------------------------------------------
diff --git a/tajo-rpc/src/main/java/org/apache/tajo/rpc/RpcConnectionPool.java b/tajo-rpc/src/main/java/org/apache/tajo/rpc/RpcConnectionPool.java
index 777281f..aba9c63 100644
--- a/tajo-rpc/src/main/java/org/apache/tajo/rpc/RpcConnectionPool.java
+++ b/tajo-rpc/src/main/java/org/apache/tajo/rpc/RpcConnectionPool.java
@@ -75,8 +75,12 @@ public class RpcConnectionPool {
     NettyClientBase client = connections.get(key);
 
     if (client == null) {
-      client = makeConnection(key);
-      boolean added = connections.putIfAbsent(key, client) == null;
+      boolean added;
+      synchronized (connections){
+        client = makeConnection(key);
+        connections.put(key, client);
+        added = true;
+      }
 
       if (!added) {
         client.close();


Mime
View raw message