hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1542391 - /hive/trunk/service/src/java/org/apache/hive/service/cli/session/SessionManager.java
Date Fri, 15 Nov 2013 20:44:45 GMT
Author: brock
Date: Fri Nov 15 20:44:45 2013
New Revision: 1542391

URL: http://svn.apache.org/r1542391
Log:
HIVE-5732 - HiveServer2: Duplicated new OperationManager in SessionManager (Navis via Brock
Noland)

Modified:
    hive/trunk/service/src/java/org/apache/hive/service/cli/session/SessionManager.java

Modified: hive/trunk/service/src/java/org/apache/hive/service/cli/session/SessionManager.java
URL: http://svn.apache.org/viewvc/hive/trunk/service/src/java/org/apache/hive/service/cli/session/SessionManager.java?rev=1542391&r1=1542390&r2=1542391&view=diff
==============================================================================
--- hive/trunk/service/src/java/org/apache/hive/service/cli/session/SessionManager.java (original)
+++ hive/trunk/service/src/java/org/apache/hive/service/cli/session/SessionManager.java Fri
Nov 15 20:44:45 2013
@@ -18,9 +18,9 @@
 
 package org.apache.hive.service.cli.session;
 
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.Future;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ThreadPoolExecutor;
@@ -41,11 +41,15 @@ import org.apache.hive.service.cli.opera
  *
  */
 public class SessionManager extends CompositeService {
+
   private static final Log LOG = LogFactory.getLog(CompositeService.class);
+
   private HiveConf hiveConf;
-  private final Map<SessionHandle, HiveSession> handleToSession = new HashMap<SessionHandle,
HiveSession>();
-  private OperationManager operationManager = new OperationManager();
-  private static final Object sessionMapLock = new Object();
+
+  private final Map<SessionHandle, HiveSession> handleToSession =
+      new ConcurrentHashMap<SessionHandle, HiveSession>();
+  private final OperationManager operationManager = new OperationManager();
+
   private ThreadPoolExecutor backgroundOperationPool;
 
   public SessionManager() {
@@ -55,7 +59,6 @@ public class SessionManager extends Comp
   @Override
   public synchronized void init(HiveConf hiveConf) {
     this.hiveConf = hiveConf;
-    operationManager = new OperationManager();
     int backgroundPoolSize = hiveConf.getIntVar(ConfVars.HIVE_SERVER2_ASYNC_EXEC_THREADS);
     LOG.info("HiveServer2: Async execution thread pool size: " + backgroundPoolSize);
     int backgroundPoolQueueSize = hiveConf.getIntVar(ConfVars.HIVE_SERVER2_ASYNC_EXEC_WAIT_QUEUE_SIZE);
@@ -113,9 +116,9 @@ public class SessionManager extends Comp
     }
     session.setSessionManager(this);
     session.setOperationManager(operationManager);
-    synchronized(sessionMapLock) {
-      handleToSession.put(session.getSessionHandle(), session);
-    }
+
+    handleToSession.put(session.getSessionHandle(), session);
+
     try {
       executeSessionHooks(session);
     } catch (Exception e) {
@@ -125,10 +128,7 @@ public class SessionManager extends Comp
   }
 
   public void closeSession(SessionHandle sessionHandle) throws HiveSQLException {
-    HiveSession session;
-    synchronized(sessionMapLock) {
-      session = handleToSession.remove(sessionHandle);
-    }
+    HiveSession session = handleToSession.remove(sessionHandle);
     if (session == null) {
       throw new HiveSQLException("Session does not exist!");
     }
@@ -136,10 +136,7 @@ public class SessionManager extends Comp
   }
 
   public HiveSession getSession(SessionHandle sessionHandle) throws HiveSQLException {
-    HiveSession session;
-    synchronized(sessionMapLock) {
-      session = handleToSession.get(sessionHandle);
-    }
+    HiveSession session = handleToSession.get(sessionHandle);
     if (session == null) {
       throw new HiveSQLException("Invalid SessionHandle: " + sessionHandle);
     }



Mime
View raw message