You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sh...@apache.org on 2016/11/03 18:38:45 UTC
[3/4] airavata git commit: Refactored code a bit
Refactored code a bit
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/1ab0102d
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/1ab0102d
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/1ab0102d
Branch: refs/heads/develop
Commit: 1ab0102dff06b55ff2c3b633050667c076bc3364
Parents: 946143a
Author: Shameera Rathnayaka <sh...@gmail.com>
Authored: Thu Nov 3 14:37:51 2016 -0400
Committer: Shameera Rathnayaka <sh...@gmail.com>
Committed: Thu Nov 3 14:37:51 2016 -0400
----------------------------------------------------------------------
.../cloud/aurora/client/AuroraThriftClient.java | 12 ++++++------
.../apache/airavata/cloud/aurora/util/Constants.java | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/1ab0102d/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/AuroraThriftClient.java
----------------------------------------------------------------------
diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/AuroraThriftClient.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/AuroraThriftClient.java
index e955dc5..fc03fdf 100644
--- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/AuroraThriftClient.java
+++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/client/AuroraThriftClient.java
@@ -19,7 +19,6 @@
*/
package org.apache.airavata.cloud.aurora.client;
-import java.text.MessageFormat;
import java.util.HashSet;
import java.util.Set;
@@ -83,7 +82,8 @@ public class AuroraThriftClient {
Integer connectTimeout = ServerSettings.getAuroraSchedulerTimeout();
// check reachable scheduler host
- if(auroraHosts != null) {
+ if(auroraHosts != null && !auroraHosts.trim().isEmpty()) {
+ auroraHosts = auroraHosts.trim();
for(String auroraHost : auroraHosts.split(",")) {
// malformed host string, should be of form <host:port>
if(auroraHost.split(":").length != 2) {
@@ -93,7 +93,7 @@ public class AuroraThriftClient {
// read hostname, port & construct connection-url
String hostname = auroraHost.split(":")[0];
String port = auroraHost.split(":")[1];
- String connectionUrl = MessageFormat.format(Constants.AURORA_SCHEDULER_CONNECTION_URL, hostname, port);
+ String connectionUrl = String.format(Constants.AURORA_SCHEDULER_CONNECTION_URL, hostname, port);
// verify if connection succeeds
if(AuroraThriftClientUtil.isSchedulerHostReachable(connectionUrl, connectTimeout)) {
@@ -106,7 +106,7 @@ public class AuroraThriftClient {
// check if scheduler connection successful
if(thriftClient.auroraSchedulerManagerClient == null ||
thriftClient.readOnlySchedulerClient == null) {
- throw new Exception("None of the Aurora scheduler hosts were reachable, hence connection not established!");
+ throw new Exception("None of the Aurora scheduler hosts : <" + auroraHosts + "> were reachable, hence connection not established!");
}
} else {
// aurora hosts not defined in the properties file
@@ -116,7 +116,7 @@ public class AuroraThriftClient {
}
}
} catch(Exception ex) {
- logger.error(ex.getMessage(), ex);
+ logger.error("Couldn't initialize Aurora thrift client", ex);
throw ex;
}
return thriftClient;
@@ -147,7 +147,7 @@ public class AuroraThriftClient {
// read hostname, port & construct connection-url
String hostname = auroraHost.split(":")[0];
String port = auroraHost.split(":")[1];
- String connectionUrl = MessageFormat.format(Constants.AURORA_SCHEDULER_CONNECTION_URL, hostname, port);
+ String connectionUrl = String.format(Constants.AURORA_SCHEDULER_CONNECTION_URL, hostname, port);
// verify if connection succeeds
if(AuroraThriftClientUtil.isSchedulerHostReachable(connectionUrl, connectTimeout)) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/1ab0102d/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/util/Constants.java
----------------------------------------------------------------------
diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/util/Constants.java b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/util/Constants.java
index 2796541..fea8d92 100644
--- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/util/Constants.java
+++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/util/Constants.java
@@ -40,7 +40,7 @@ public class Constants {
public static final String MESOS_CLUSTER_NAME = "mesos.cluster.name";
/** The Constant AURORA_SCHEDULER_CONNECTION_URL. */
- public static final String AURORA_SCHEDULER_CONNECTION_URL = "http://{0}:{1}/api";
+ public static final String AURORA_SCHEDULER_CONNECTION_URL = "http://%s:%s/api";
/** The Constant AURORA_SCHEDULER_CONNECT_TIMEOUT_MS. */
public static final String AURORA_SCHEDULER_CONNECT_TIMEOUT_MS = "aurora.scheduler.timeoutms";