airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dimuthu...@apache.org
Subject [airavata] branch develop updated: Gracefully handle the registry client usage
Date Thu, 17 Jan 2019 18:33:05 GMT
This is an automated email from the ASF dual-hosted git repository.

dimuthuupe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/develop by this push:
     new 44b8f29  Gracefully handle the registry client usage
44b8f29 is described below

commit 44b8f2970867aadf25bf22b7903db1f872b58180
Author: Dimuthu Wannipurage <dimuthu.upeksha2@gmail.com>
AuthorDate: Thu Jan 17 13:32:54 2019 -0500

    Gracefully handle the registry client usage
---
 .../airavata/helix/impl/workflow/ParserWorkflowManager.java    | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/workflow/ParserWorkflowManager.java
b/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/workflow/ParserWorkflowManager.java
index 53d2ad3..95367f4 100644
--- a/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/workflow/ParserWorkflowManager.java
+++ b/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/workflow/ParserWorkflowManager.java
@@ -71,9 +71,10 @@ public class ParserWorkflowManager extends WorkflowManager {
     }
 
     private boolean process(ProcessCompletionMessage completionMessage) {
-        try {
 
-            RegistryService.Client registryClient = getRegistryClientPool().getResource();
+        RegistryService.Client registryClient = getRegistryClientPool().getResource();
+
+        try {
             ProcessModel processModel;
             ApplicationInterfaceDescription appDescription;
             try {
@@ -83,8 +84,6 @@ public class ParserWorkflowManager extends WorkflowManager {
             } catch (Exception e) {
                 logger.error("Failed to fetch process or application description from registry
associated with process id " + completionMessage.getProcessId(), e);
                 throw new Exception("Failed to fetch process or application description from
registry associated with process id " + completionMessage.getProcessId(), e);
-            } finally {
-                getRegistryClientPool().returnResource(registryClient);
             }
 
             // All the templates should be run
@@ -154,11 +153,14 @@ public class ParserWorkflowManager extends WorkflowManager {
                         allTasks, true, false);
                 logger.info("Launched workflow " + workflow);
             }
+
+            getRegistryClientPool().returnResource(registryClient);
             return true;
 
 
         } catch (Exception e) {
             logger.error("Failed to create the DataParsing task DAG", e);
+            getRegistryClientPool().returnBrokenResource(registryClient);
             return false;
         }
     }


Mime
View raw message