ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbhowm...@apache.org
Subject ambari git commit: AMBARI-18768. Session invalidation for hive view. (Ashwin Rajeev via dipayanb)
Date Wed, 02 Nov 2016 19:08:16 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk e9b251210 -> a8727af88


AMBARI-18768. Session invalidation for hive view. (Ashwin Rajeev via dipayanb)


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

Branch: refs/heads/trunk
Commit: a8727af88fd5f6ba5d889854589093e19efdf27a
Parents: e9b2512
Author: Dipayan Bhowmick <dipayan.bhowmick@gmail.com>
Authored: Thu Nov 3 00:37:05 2016 +0530
Committer: Dipayan Bhowmick <dipayan.bhowmick@gmail.com>
Committed: Thu Nov 3 00:37:53 2016 +0530

----------------------------------------------------------------------
 .../apache/ambari/view/hive2/actor/JdbcConnector.java    |  2 +-
 .../ambari/view/hive2/client/AsyncJobRunnerImpl.java     | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a8727af8/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/actor/JdbcConnector.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/actor/JdbcConnector.java
b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/actor/JdbcConnector.java
index bb438d2..fcbef81 100644
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/actor/JdbcConnector.java
+++ b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/actor/JdbcConnector.java
@@ -385,8 +385,8 @@ public class JdbcConnector extends HiveActor {
       updateJobStatus(jobId.get(), Job.JOB_STATE_ERROR);
     } else {
       sender().tell(new ExecutionFailed("Cannot connect to hive"), ActorRef.noSender());
-      cleanUpWithTermination();
     }
+    cleanUpWithTermination();
   }
 
   private void keepAlive() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/a8727af8/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/client/AsyncJobRunnerImpl.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/client/AsyncJobRunnerImpl.java
b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/client/AsyncJobRunnerImpl.java
index 182dfbc..82e3df5 100644
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/client/AsyncJobRunnerImpl.java
+++ b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/client/AsyncJobRunnerImpl.java
@@ -33,6 +33,8 @@ import org.apache.ambari.view.hive2.actor.message.ResultNotReady;
 import org.apache.ambari.view.hive2.actor.message.SQLStatementJob;
 import org.apache.ambari.view.hive2.actor.message.job.CancelJob;
 import org.apache.ambari.view.hive2.actor.message.job.Failure;
+import org.apache.ambari.view.hive2.actor.message.job.FetchFailed;
+import org.apache.ambari.view.hive2.internal.ConnectionException;
 import org.apache.ambari.view.hive2.resources.jobs.viewJobs.Job;
 import org.apache.ambari.view.hive2.utils.ResultFetchFormattedException;
 import org.apache.ambari.view.hive2.utils.ResultNotReadyFormattedException;
@@ -40,6 +42,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import scala.concurrent.duration.Duration;
 
+import java.sql.SQLException;
 import java.util.concurrent.TimeUnit;
 
 public class AsyncJobRunnerImpl implements AsyncJobRunner {
@@ -124,9 +127,17 @@ public class AsyncJobRunnerImpl implements AsyncJobRunner {
     Inbox inbox = Inbox.create(system);
     inbox.send(controller, new FetchError(jobId, username));
     Object receive = inbox.receive(Duration.create(1, TimeUnit.MINUTES));
+    if(receive instanceof FetchFailed){
+      FetchFailed fetchFailed = (FetchFailed) receive;
+      return Optional.of(new Failure(fetchFailed.getMessage(), getExceptionForRetry()));
+    }
     Optional<Failure> result = (Optional<Failure>) receive;
     return result;
   }
 
+  private ConnectionException getExceptionForRetry() {
+    return new ConnectionException(new SQLException("Cannot connect"),"Connection attempt
failed, Please retry");
+  }
+
 
 }


Mime
View raw message