You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by gn...@apache.org on 2017/04/25 06:33:45 UTC

ambari git commit: AMBARI-18387. Unable to delete Hive view. (Dipayan Bhowmick via gauravn7)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 ad40cd526 -> 60a6805d7


AMBARI-18387. Unable to delete Hive view. (Dipayan Bhowmick via gauravn7)


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

Branch: refs/heads/branch-2.4
Commit: 60a6805d7ad9807d66bcecd895d0e4290b8e6b07
Parents: ad40cd5
Author: Gaurav Nagar <gr...@gmail.com>
Authored: Tue Apr 25 12:03:01 2017 +0530
Committer: Gaurav Nagar <gr...@gmail.com>
Committed: Tue Apr 25 12:03:14 2017 +0530

----------------------------------------------------------------------
 .../ambari/view/hive2/ConnectionSystem.java      | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/60a6805d/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 e6e533f..d1a9eea 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
@@ -23,6 +23,8 @@ import akka.actor.ActorSystem;
 import akka.actor.Inbox;
 import akka.actor.PoisonPill;
 import akka.actor.Props;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
 import com.google.common.base.Optional;
 import org.apache.ambari.view.ViewContext;
 import org.apache.ambari.view.hive2.actor.DeathWatch;
@@ -49,8 +51,9 @@ public class ConnectionSystem {
   private static Map<String, String> credentialsMap = 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() {
@@ -86,12 +89,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);
@@ -116,9 +119,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());
+      }
     }
   }