You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by db...@apache.org on 2016/09/19 05:52:30 UTC

ambari git commit: AMBARI-18387. Unable to delete Hive view. (dipayanb)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 084cf1760 -> e6ca77224


AMBARI-18387. Unable to delete Hive view. (dipayanb)


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

Branch: refs/heads/branch-2.5
Commit: e6ca77224afa72e3e9ec19ef8bbd5d200c3623b5
Parents: 084cf17
Author: Dipayan Bhowmick <di...@gmail.com>
Authored: Wed Sep 14 15:36:56 2016 +0530
Committer: Dipayan Bhowmick <di...@gmail.com>
Committed: Mon Sep 19 11:21:52 2016 +0530

----------------------------------------------------------------------
 .../ambari/view/hive2/ConnectionSystem.java     | 23 ++++++++++++--------
 1 file changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e6ca7722/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/ConnectionSystem.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/ConnectionSystem.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/ConnectionSystem.java
index f534130..88ea3d7 100644
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/ConnectionSystem.java
+++ b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/ConnectionSystem.java
@@ -24,6 +24,8 @@ import akka.actor.Inbox;
 import akka.actor.PoisonPill;
 import akka.actor.Props;
 import com.google.common.collect.Multimap;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
 import org.apache.ambari.view.ViewContext;
 import org.apache.ambari.view.hive2.actor.DeathWatch;
 import org.apache.ambari.view.hive2.actor.OperationController;
@@ -45,8 +47,9 @@ public class ConnectionSystem {
   private static Map<String, Map<String, ActorRef>> operationControllerMap = new ConcurrentHashMap<>();
 
   private ConnectionSystem() {
-    this.actorSystem = ActorSystem.create(ACTOR_SYSTEM_NAME);
-    ;
+    ClassLoader classLoader = getClass().getClassLoader();
+    Config config = ConfigFactory.load(classLoader);
+    this.actorSystem = ActorSystem.create(ACTOR_SYSTEM_NAME, config, classLoader);
   }
 
   public static ConnectionSystem getInstance() {
@@ -63,8 +66,8 @@ public class ConnectionSystem {
   private ActorRef createOperationController(ViewContext context) {
     ActorRef deathWatch = actorSystem.actorOf(Props.create(DeathWatch.class));
     return actorSystem.actorOf(
-      Props.create(OperationController.class, actorSystem, deathWatch, context,
-        new ConnectionSupplier(), new DataStorageSupplier(), new HdfsApiSupplier()));
+        Props.create(OperationController.class, actorSystem, deathWatch, context,
+            new ConnectionSupplier(), new DataStorageSupplier(), new HdfsApiSupplier()));
   }
 
   public ActorSystem getActorSystem() {
@@ -82,12 +85,12 @@ public class ConnectionSystem {
     String instanceName = context.getInstanceName();
     ActorRef ref = null;
     Map<String, ActorRef> stringActorRefMap = operationControllerMap.get(instanceName);
-    if(stringActorRefMap != null) {
+    if (stringActorRefMap != null) {
       ref = stringActorRefMap.get(context.getUsername());
     }
     if (ref == null) {
       ref = createOperationController(context);
-      if(stringActorRefMap == null) {
+      if (stringActorRefMap == null) {
         stringActorRefMap = new HashMap<>();
         stringActorRefMap.put(context.getUsername(), ref);
         operationControllerMap.put(instanceName, stringActorRefMap);
@@ -100,9 +103,11 @@ public class ConnectionSystem {
 
   public void removeOperationControllerFromCache(String viewInstanceName) {
     Map<String, ActorRef> refs = operationControllerMap.remove(viewInstanceName);
-    for (ActorRef ref : refs.values()) {
-      Inbox inbox = Inbox.create(getActorSystem());
-      inbox.send(ref, PoisonPill.getInstance());
+    if (refs != null) {
+      for (ActorRef ref : refs.values()) {
+        Inbox inbox = Inbox.create(getActorSystem());
+        inbox.send(ref, PoisonPill.getInstance());
+      }
     }
   }