You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by hi...@apache.org on 2011/04/25 12:47:56 UTC

svn commit: r1096455 - in /synapse/trunk/java/modules/core/src/main/java/org/apache/synapse: core/axis2/ProxyService.java deployers/ProxyServiceDeployer.java

Author: hiranya
Date: Mon Apr 25 10:47:55 2011
New Revision: 1096455

URL: http://svn.apache.org/viewvc?rev=1096455&view=rev
Log:
Adding fail safe mode to the ProxyService#buildAxisService method

Modified:
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/ProxyServiceDeployer.java

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java?rev=1096455&r1=1096454&r2=1096455&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyService.java Mon Apr 25 10:47:55 2011
@@ -275,6 +275,13 @@ public class ProxyService implements Asp
                 handleException("Malformed URI for wsdl", e);
             } catch (IOException e) {
                 //handleException("Error reading from wsdl URI", e);
+
+                if (isFailSafeEnabled(axisCfg)) {
+                    log.warn("Proxy Service configuration : " + name + " cannot be built.", e);
+                    log.warn("Continue in Proxy Service Fail-safe mode.");
+                    return null;
+                }
+
                 boolean enablePublishWSDLSafeMode = false;
                 Map proxyParameters= this.getParameterMap();
                 if (!proxyParameters.isEmpty()) {
@@ -331,7 +338,7 @@ public class ProxyService implements Asp
         if (wsdlElement != null) {
             OMNamespace wsdlNamespace = wsdlElement.getNamespace();
 
-            // serialize and create an inputstream to read WSDL
+            // serialize and create an input stream to read WSDL
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             try {
                 if (trace()) trace.info("Serializing wsdlElement found to build an Axis2 service");
@@ -628,6 +635,22 @@ public class ProxyService implements Asp
         return proxyService;
     }
 
+    private boolean isFailSafeEnabled(AxisConfiguration axisConfig) {
+        String failSafeStr = SynapseConfigUtils.getSynapseEnvironment(axisConfig).
+                getSynapseConfiguration().getProperty(SynapseConstants.FAIL_SAFE_MODE_STATUS);
+        if (failSafeStr != null) {
+            String[] failSafeComponents = failSafeStr.split(",");
+            List<String> stringList = Arrays.<String>asList(failSafeComponents);
+            if (stringList.indexOf(SynapseConstants.FAIL_SAFE_MODE_ALL) >= 0
+                    || stringList.indexOf(SynapseConstants.FAIL_SAFE_MODE_PROXY_SERVICES) >= 0) {
+                return true;
+            }
+        } else {
+            return true; // Enabled by default
+        }
+        return false;
+    }
+
     private void setUserDefinedResourceResolvers(SynapseConfiguration synCfg,
                                                  InputStream wsdlInputStream,
                                                  WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder) {

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/ProxyServiceDeployer.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/ProxyServiceDeployer.java?rev=1096455&r1=1096454&r2=1096455&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/ProxyServiceDeployer.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/deployers/ProxyServiceDeployer.java Mon Apr 25 10:47:55 2011
@@ -99,7 +99,7 @@ public class ProxyServiceDeployer extend
             }
         } catch (Exception e) {
             if (failSafeProxyEnabled) {
-                log.warn("Proxy Service : " + fileName + " : Hot Deployment Failed" + e.getMessage());
+                log.warn("Proxy Service : " + fileName + " : Hot Deployment Failed - " + e.getMessage());
                 log.warn("Proxy Service : Fail-Safe mode.");
             } else {
                 handleSynapseArtifactDeploymentError(