diff --git a/src/main/java/org/gcube/vremanagement/executor/client/SmartExecutorClientImpl.java b/src/main/java/org/gcube/vremanagement/executor/client/SmartExecutorClientImpl.java index bb3af10..d1a4786 100644 --- a/src/main/java/org/gcube/vremanagement/executor/client/SmartExecutorClientImpl.java +++ b/src/main/java/org/gcube/vremanagement/executor/client/SmartExecutorClientImpl.java @@ -42,6 +42,10 @@ public class SmartExecutorClientImpl implements SmartExecutorClient { protected String host; protected String address; + public static String getHostFromCompleteURL(String address) { + return address.split("(http)s{0,1}://")[1].split(":")[0]; + } + @Override public String getHost() { return host; @@ -53,7 +57,7 @@ public class SmartExecutorClientImpl implements SmartExecutorClient { public void setAddress(String address) { this.address = address; - this.host = address.split("(http)s{0,1}://")[1].split(":")[0]; + this.host = getHostFromCompleteURL(address); } public String getPluginName() { @@ -151,7 +155,7 @@ public class SmartExecutorClientImpl implements SmartExecutorClient { private String getScheduledTask(String name) { try { - logger.info("Going to get orphan scheduled tasks"); + logger.info("Going to get {} scheduled tasks", name); GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address); gxHTTPStringRequest.from(SmartExecutorClient.class.getSimpleName()); @@ -161,11 +165,11 @@ public class SmartExecutorClientImpl implements SmartExecutorClient { gxHTTPStringRequest.path(RestConstants.EXECUTIONS_PATH_PART); HttpURLConnection httpURLConnection = gxHTTPStringRequest.get(); - String orphanList = parseHttpURLConnection(httpURLConnection); + String scheduledList = parseHttpURLConnection(httpURLConnection); - logger.info("Orphan schadule task are {}", orphanList); + logger.info("{} scheduled task are {}", name, scheduledList); - return orphanList; + return scheduledList; } catch(WebApplicationException e) { throw e; } catch(Exception e) {