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 2015/04/15 22:48:55 UTC

[19/28] airavata git commit: fixing exception handling

fixing exception handling


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

Branch: refs/heads/emailMonitoring
Commit: c92fbd39dfe35adcebe5b25a804b1d70b0023635
Parents: be901aa
Author: Lahiru Gunathilake <gl...@gmail.com>
Authored: Wed Apr 15 08:58:04 2015 -0400
Committer: Lahiru Gunathilake <gl...@gmail.com>
Committed: Wed Apr 15 08:58:04 2015 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/airavata/gfac/server/GfacServer.java | 2 ++
 .../org/apache/airavata/gfac/server/GfacServerHandler.java    | 7 ++++++-
 .../airavata/gfac/core/utils/GFacThreadPoolExecutor.java      | 3 ++-
 3 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/c92fbd39/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServer.java
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServer.java b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServer.java
index e37a9ab..01115b6 100644
--- a/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServer.java
+++ b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServer.java
@@ -23,6 +23,7 @@ package org.apache.airavata.gfac.server;
 import org.apache.airavata.common.utils.Constants;
 import org.apache.airavata.common.utils.IServer;
 import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.gfac.core.utils.GFacThreadPoolExecutor;
 import org.apache.airavata.gfac.cpi.GfacService;
 import org.apache.thrift.server.TServer;
 import org.apache.thrift.server.TThreadPoolServer;
@@ -109,6 +110,7 @@ public class GfacServer implements IServer{
 			setStatus(IServer.ServerStatus.STOPING);
 			server.stop();
 		}
+		GFacThreadPoolExecutor.getFixedThreadPool().shutdownNow();
 
 	}
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/c92fbd39/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
index f3e1d91..6652db0 100644
--- a/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
+++ b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
@@ -255,7 +255,12 @@ public class GfacServerHandler implements GfacService.Iface, Watcher {
         logger.debugId(experimentId, "Submitted job to the Gfac Implementation, experiment {}, task {}, gateway " +
                 "{}", experimentId, taskId, gatewayId);
 
-        GFacThreadPoolExecutor.getFixedThreadPool().execute(inputHandlerWorker);
+        try {
+            GFacThreadPoolExecutor.getFixedThreadPool().execute(inputHandlerWorker);
+        } catch (ApplicationSettingsException e) {
+            logger.error(e.getMessage(), e);
+            throw new TException(e);
+        }
 
         // we immediately return when we have a threadpool
         return true;

http://git-wip-us.apache.org/repos/asf/airavata/blob/c92fbd39/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacThreadPoolExecutor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacThreadPoolExecutor.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacThreadPoolExecutor.java
index 7853513..3c8d56a 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacThreadPoolExecutor.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacThreadPoolExecutor.java
@@ -41,12 +41,13 @@ public class GFacThreadPoolExecutor {
         return threadPool;
     }
 
-    public static ExecutorService getFixedThreadPool() {
+    public static ExecutorService getFixedThreadPool() throws ApplicationSettingsException {
         if(threadPool ==null){
             try {
                 threadPool = Executors.newFixedThreadPool(Integer.parseInt(ServerSettings.getSetting(GFAC_THREAD_POOL_SIZE)));
             } catch (ApplicationSettingsException e) {
                 logger.error("Error reading " + GFAC_THREAD_POOL_SIZE+ " property");
+                throw e;
             }
         }
         return threadPool;