Author: lahiru
Date: Mon Oct 22 19:15:44 2012
New Revision: 1401017

URL: http://svn.apache.org/viewvc?rev=1401017&view=rev
Log:
removing error during shutdown at the middle.

Modified:
    
airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java

Modified: 
airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java?rev=1401017&r1=1401016&r2=1401017&view=diff
==============================================================================
--- 
airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java
 (original)
+++ 
airavata/trunk/modules/gfac-axis2/src/main/java/org/apache/airavata/services/gfac/axis2/GFacService.java
 Mon Oct 22 19:15:44 2012
@@ -158,18 +158,23 @@ public class GFacService implements Serv
     }
 
     public void shutDown(ConfigurationContext configctx, AxisService service) {
-        AiravataRegistry2 registry = ((GFacConfiguration) 
configctx.getProperty(GFAC_CONFIGURATION)).getRegistry();
-        String gfacURL = (String) configctx.getProperty(GFAC_URL);
-        try {
-            registry.removeGFacURI(new URI(gfacURL));
-        } catch (URISyntaxException e) {
-            e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
+        //following nullchecks will avoid the exceptions when user press 
Ctrl-C before the server start properly
+        if (configctx.getProperty(GFAC_CONFIGURATION) != null) {
+            AiravataRegistry2 registry = ((GFacConfiguration) 
configctx.getProperty(GFAC_CONFIGURATION)).getRegistry();
+            String gfacURL = (String) configctx.getProperty(GFAC_URL);
+            try {
+                registry.removeGFacURI(new URI(gfacURL));
+            } catch (URISyntaxException e) {
+                e.printStackTrace();  //To change body of catch statement use 
File | Settings | File Templates.
+            }
         }
-        thread.interrupt();
-        try {
-            thread.join();
-        } catch (InterruptedException e) {
-            log.info("GFacURL update thread is interrupted");
+        if (thread != null) {
+            thread.interrupt();
+            try {
+                thread.join();
+            } catch (InterruptedException e) {
+                log.info("GFacURL update thread is interrupted");
+            }
         }
     }
 


Reply via email to