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 20:08:06 UTC

svn commit: r1096547 - in /synapse/trunk/java/modules/core/src/main/java/org/apache/synapse: ./ config/ config/xml/ core/axis2/ deployers/

Author: hiranya
Date: Mon Apr 25 18:08:06 2011
New Revision: 1096547

URL: http://svn.apache.org/viewvc?rev=1096547&view=rev
Log:
Refactoring the fail safe mode logic

Modified:
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/Axis2SynapseController.java
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfigUtils.java
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java
    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/Axis2SynapseController.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/Axis2SynapseController.java?rev=1096547&r1=1096546&r2=1096547&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/Axis2SynapseController.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/Axis2SynapseController.java Mon Apr 25 18:08:06 2011
@@ -35,16 +35,13 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.synapse.commons.datasource.DataSourceRepositoryHolder;
 import org.apache.synapse.commons.util.RMIRegistryController;
+import org.apache.synapse.config.*;
 import org.apache.synapse.securevault.SecurityConstants;
 import org.apache.synapse.securevault.secret.SecretCallbackHandler;
 import org.apache.synapse.commons.datasource.DataSourceInformationRepository;
 import org.apache.synapse.commons.datasource.DataSourceConstants;
 import org.apache.synapse.commons.jmx.JmxInformation;
 import org.apache.synapse.commons.jmx.JmxInformationFactory;
-import org.apache.synapse.config.Entry;
-import org.apache.synapse.config.SynapseConfiguration;
-import org.apache.synapse.config.SynapseConfigurationBuilder;
-import org.apache.synapse.config.SynapsePropertiesLoader;
 import org.apache.synapse.core.SynapseEnvironment;
 import org.apache.synapse.core.axis2.*;
 import org.apache.synapse.eventing.SynapseEventSource;
@@ -160,7 +157,7 @@ public class Axis2SynapseController impl
             log.fatal("Error adding the parameter to the Axis Configuration");
         }
 
-        // we retrieve these properties to initialize the task scheduler in the envrionment
+        // we retrieve these properties to initialize the task scheduler in the environment
         Object repo =
                 serverContextInformation.getProperty(TaskConstants.TASK_DESCRIPTION_REPOSITORY);
         Object taskScheduler = serverContextInformation.getProperty(TaskConstants.TASK_SCHEDULER);
@@ -190,7 +187,7 @@ public class Axis2SynapseController impl
     private void initXpathExtensions() {
         Axis2SynapseEnvironment axis2SynapseEnvironment = (Axis2SynapseEnvironment) synapseEnvironment;
 
-        /*Initalize Function Context extensions for xpath
+        /*Initialize Function Context extensions for xpath
          */
         List<SynapseXpathFunctionContextProvider> functionExtensions =
                 XpathExtensionUtil.getRegisteredFunctionExtensions();
@@ -198,7 +195,7 @@ public class Axis2SynapseController impl
             axis2SynapseEnvironment.setXpathFunctionExtensions(functionExtension);
         }
 
-        /*Initalize Variable Context extensions for xpath
+        /*Initialize Variable Context extensions for xpath
          */
         List<SynapseXpathVariableResolver> variableExtensions =
                 XpathExtensionUtil.getRegisteredVariableExtensions();
@@ -290,9 +287,9 @@ public class Axis2SynapseController impl
      * {@inheritDoc}
      */
     public void startMaintenance() {
-        log.info("Putting transport listners, senders and tasks into maintenence mode..");
+        log.info("Putting transport listeners, senders and tasks into maintenance mode..");
 
-        // pause transport listers and senders
+        // pause transport listeners and senders
         Axis2TransportHelper transportHelper = new Axis2TransportHelper(configurationContext);
         transportHelper.pauseListeners();
         transportHelper.pauseSenders();
@@ -303,14 +300,14 @@ public class Axis2SynapseController impl
             synapseTaskManager.pauseAll();
         }
 
-        log.info("Entered maintenence mode");
+        log.info("Entered maintenance mode");
     }
 
     /**
      * {@inheritDoc}
      */
     public void endMaintenance() {
-        log.info("Resuming transport listners, senders and tasks from maintenence mode...");
+        log.info("Resuming transport listeners, senders and tasks from maintenance mode...");
 
         // resume transport listeners and senders
         Axis2TransportHelper transportHelper = new Axis2TransportHelper(configurationContext);
@@ -323,7 +320,7 @@ public class Axis2SynapseController impl
             synapseTaskManager.resumeAll();
         }
 
-        log.info("Resumed normal operation from maintenence mode");
+        log.info("Resumed normal operation from maintenance mode");
     }
 
     /**
@@ -387,7 +384,7 @@ public class Axis2SynapseController impl
                 }
             }
         } catch (AxisFault e) {
-            log.error("Error stopping the Axis2 Environemnt");
+            log.error("Error stopping the Axis2 Environment");
         }
     }
 
@@ -493,7 +490,7 @@ public class Axis2SynapseController impl
                     "' to the Axis2 configuration : " + e.getMessage(), e);
         }
 
-        addServerIPAndHostEnrties();
+        addServerIPAndHostEntries();
 
         return synapseConfiguration;
     }
@@ -669,18 +666,8 @@ public class Axis2SynapseController impl
      */
     private void deployProxyServices() {
 
-        boolean failSafeProxyEnabled = false;
-        String failSafeMode = synapseConfiguration.getProperty(SynapseConstants.FAIL_SAFE_MODE_STATUS);
-
-        if (failSafeMode != null) {
-            String[] failSafeComponents = failSafeMode.split(",");
-            if (Arrays.<String>asList(failSafeComponents).indexOf(SynapseConstants.FAIL_SAFE_MODE_ALL) >= 0
-                    || Arrays.<String>asList(failSafeComponents).indexOf(SynapseConstants.FAIL_SAFE_MODE_PROXY_SERVICES) >= 0) {
-                failSafeProxyEnabled = true;
-            }
-        } else {
-            failSafeProxyEnabled = true; // Enabled by default
-        }
+        boolean failSafeProxyEnabled = SynapseConfigUtils.isFailSafeEnabled(
+                SynapseConstants.FAIL_SAFE_MODE_PROXY_SERVICES);
 
         log.info("Deploying Proxy services...");
         String thisServerName = serverConfigurationInformation.getServerName();
@@ -778,7 +765,7 @@ public class Axis2SynapseController impl
     }
 
     /**
-     * Initiating DataSourceRepositoryHolder with a new datasource information repository or
+     * Initiating DataSourceRepositoryHolder with a new data source information repository or
      * reusing an existing repository.
      *
      * @param serverContextInformation ServerContextInformation instance
@@ -821,7 +808,7 @@ public class Axis2SynapseController impl
         }
     }
 
-    private void addServerIPAndHostEnrties() {
+    private void addServerIPAndHostEntries() {
         String hostName = serverConfigurationInformation.getHostName();
         String ipAddress = serverConfigurationInformation.getIpAddress();
         if (hostName != null && !"".equals(hostName)) {

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfigUtils.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfigUtils.java?rev=1096547&r1=1096546&r2=1096547&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfigUtils.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfigUtils.java Mon Apr 25 18:08:06 2011
@@ -54,6 +54,7 @@ import java.io.*;
 import java.net.*;
 import java.security.KeyManagementException;
 import java.security.NoSuchAlgorithmException;
+import java.util.Arrays;
 import java.util.Properties;
 import java.util.List;
 import java.util.ArrayList;
@@ -836,5 +837,21 @@ public class SynapseConfigUtils {
 
         config.addSequence(org.apache.synapse.SynapseConstants.FAULT_SEQUENCE_KEY, fault);
     }
+
+    public static boolean isFailSafeEnabled(String componentName) {
+        Properties synapseProps = SynapsePropertiesLoader.loadSynapseProperties();
+        String failSafeStr = synapseProps.getProperty(SynapseConstants.FAIL_SAFE_MODE_STATUS);
+        if (failSafeStr != null) {
+            String[] failSafeComponents = failSafeStr.split(",");
+            List<String> componentList = Arrays.<String>asList(failSafeComponents);
+            if (componentList.indexOf(SynapseConstants.FAIL_SAFE_MODE_ALL) >= 0
+                    || componentList.indexOf(componentName) >= 0) {
+                return true;
+            }
+        } else {
+            return true; // Enabled by default
+        }
+        return false;
+    }
 }
 

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java?rev=1096547&r1=1096546&r2=1096547&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java Mon Apr 25 18:08:06 2011
@@ -45,14 +45,12 @@ import org.apache.synapse.registry.Regis
 import org.apache.axis2.AxisFault;
 
 import javax.xml.namespace.QName;
-import java.util.Arrays;
 import java.util.Iterator;
 import java.util.Properties;
 
 public class SynapseXMLConfigurationFactory implements ConfigurationFactory {
 
     private static Log log = LogFactory.getLog(SynapseXMLConfigurationFactory.class);
-    public static String failSafeStr = "";
 
     public SynapseConfiguration getConfiguration(OMElement definitions, Properties properties) {
 
@@ -63,9 +61,6 @@ public class SynapseXMLConfigurationFact
         SynapseConfiguration config = SynapseConfigUtils.newConfiguration();               
         config.setDefaultQName(definitions.getQName());
 
-        
-        failSafeStr = properties.getProperty(SynapseConstants.FAIL_SAFE_MODE_STATUS);
-
         Iterator itr = definitions.getChildren();
         while (itr.hasNext()) {
             Object o = itr.next();
@@ -97,7 +92,7 @@ public class SynapseXMLConfigurationFact
                 } else if(XMLConfigConstants.MESSAGE_STORE_ELT.equals(elt.getQName())) {
                     defineMessageStore(config, elt, properties);
                 } else if (XMLConfigConstants.MESSAGE_PROCESSOR_ELT.equals(elt.getQName())){
-                    defineMessageProcessor(config,elt,properties);
+                    defineMessageProcessor(config, elt, properties);
                 } else if (StartupFinder.getInstance().isStartup(elt.getQName())) {
                     defineStartup(config, elt, properties);
                 } else if (XMLConfigConstants.DESCRIPTION_ELT.equals(elt.getQName())) {
@@ -132,9 +127,6 @@ public class SynapseXMLConfigurationFact
 
     public static ProxyService defineProxy(SynapseConfiguration config, OMElement elem,
                                            Properties properties) {
-        boolean failSafeProxyEnabled = isFailSafeEnabled(
-                SynapseConstants.FAIL_SAFE_MODE_PROXY_SERVICES);
-
         ProxyService proxy = null;
 
         try {
@@ -143,16 +135,9 @@ public class SynapseXMLConfigurationFact
                 config.addProxyService(proxy.getName(), proxy);
             }
         } catch (Exception e) {
-            if (failSafeProxyEnabled) {
-                log.warn("Proxy Service configuration : " +
-                        elem.getAttributeValue((new QName(XMLConfigConstants.NULL_NAMESPACE, "name")))
-                        + " cannot be built.", e);
-                log.warn("Continue in Proxy Service Fail-safe mode.");
-            } else {
-                handleException("Proxy Service configuration : " +
-                        elem.getAttributeValue((new QName(XMLConfigConstants.NULL_NAMESPACE, "name")))
-                        + " cannot be built.");
-            }
+            String msg = "Proxy Service configuration: " + elem.getAttributeValue((
+                    new QName(XMLConfigConstants.NULL_NAMESPACE, "name"))) + " cannot be built";
+            handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_PROXY_SERVICES, msg, e);
         }
         
         return proxy;
@@ -160,9 +145,6 @@ public class SynapseXMLConfigurationFact
 
     public static Entry defineEntry(SynapseConfiguration config, OMElement elem,
                                     Properties properties) {
-        boolean failSafeLocalEntriesEnabled = isFailSafeEnabled(
-                SynapseConstants.FAIL_SAFE_MODE_LOCALENTRIES);
-
         Entry entry = null;
 
         try {
@@ -171,14 +153,9 @@ public class SynapseXMLConfigurationFact
                 config.addEntry(entry.getKey(), entry);
             }
         } catch (Exception e) {
-            if (failSafeLocalEntriesEnabled) {
-                log.warn("Local Entry configuration : " +
-                        elem.getAttributeValue((new QName(XMLConfigConstants.NULL_NAMESPACE, "key"))) +" cannot be built", e);
-                log.warn("Continue in Local Entry fail-safe mode.");
-            } else {
-                handleException("Local Entry configuration : " +
-                        elem.getAttributeValue((new QName(XMLConfigConstants.NULL_NAMESPACE, "key"))) +" cannot be built");
-            }
+            String msg = "Local entry configuration: " + elem.getAttributeValue((
+                    new QName(XMLConfigConstants.NULL_NAMESPACE, "key"))) + " cannot be built";
+            handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_LOCALENTRIES, msg, e);
         }
         return entry;
     }
@@ -186,9 +163,6 @@ public class SynapseXMLConfigurationFact
     public static Mediator defineSequence(SynapseConfiguration config, OMElement ele,
                                           Properties properties) {
 
-        boolean failSafeSequenceEnabled = isFailSafeEnabled(
-                SynapseConstants.FAIL_SAFE_MODE_SEQUENCES);
-
         Mediator mediator = null;
         String name = ele.getAttributeValue(new QName(XMLConfigConstants.NULL_NAMESPACE, "name"));
         if (name != null) {
@@ -204,21 +178,13 @@ public class SynapseXMLConfigurationFact
                     }
                 }
             } catch (Exception e) {
-                if (failSafeSequenceEnabled) {
-                    log.warn("Sequence configuration : " + name +" cannot be built.", e);
-                    log.warn("Continue in Sequence fail-safe mode.");
-                } else {
-                    handleException("Sequence configuration : " + name +" cannot be built.");
-                }
+                String msg = "Sequence configuration : " + name + " cannot be built";
+                handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_SEQUENCES, msg, e);
             }
             return mediator;
         } else {
-            if (failSafeSequenceEnabled) {
-                log.warn("Invalid sequence definition without a name");
-                log.warn("Continue in Sequence fail-safe mode.");
-            } else {
-                handleException("Invalid sequence definition without a name");
-            }
+            String msg = "Invalid sequence definition without a name";
+            handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_SEQUENCES, msg);
         }
         return null;
     }
@@ -226,9 +192,6 @@ public class SynapseXMLConfigurationFact
     public static Mediator defineMediatorTemplate(SynapseConfiguration config, OMElement ele,
                                                   Properties properties) {
 
-        boolean failSafeSequenceEnabled = isFailSafeEnabled(
-                SynapseConstants.FAIL_SAFE_MODE_TEMPLATES);
-
         Mediator mediator = null;
         String name = ele.getAttributeValue(new QName(XMLConfigConstants.NULL_NAMESPACE, "name"));
         if (name != null) {
@@ -238,28 +201,19 @@ public class SynapseXMLConfigurationFact
                     config.addSequenceTemplate(name, (TemplateMediator) mediator) ;
                 }
             } catch (Exception e) {
-                if (failSafeSequenceEnabled) {
-                    log.warn("Template configuration : " + name +" cannot be built.", e);
-                    log.warn("Continue in fail-safe mode.");
-                } else {
-                    handleException("Template configuration : " + name +" cannot be built.");
-                }
+                String msg = "Template configuration : " + name + " cannot be built";
+                handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_TEMPLATES, msg, e);
             }
             return mediator;
         } else {
-            if (failSafeSequenceEnabled) {
-                log.warn("Invalid template definition without a name");
-                log.warn("Continue in fail-safe mode.");
-            } else {
-                handleException("Invalid template definition without a name");
-            }
+            String msg = "Invalid mediation template definition without a name";
+            handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_SEQUENCES, msg);
         }
         return null;
     }
 
     public static Endpoint defineEndpoint(SynapseConfiguration config, OMElement ele,
                                           Properties properties) {
-        boolean failSafeEpEnabled = isFailSafeEnabled(SynapseConstants.FAIL_SAFE_MODE_EP);
 
         String name = ele.getAttributeValue(new QName(XMLConfigConstants.NULL_NAMESPACE, "name"));
         Endpoint endpoint = null;
@@ -270,29 +224,20 @@ public class SynapseXMLConfigurationFact
                     config.addEndpoint(name.trim(), endpoint);
                 }
             } catch (Exception e) {
-                if (failSafeEpEnabled) {
-                    log.warn("Endpoint configuration : " + name + " cannot be built.", e);
-                    log.warn("Continue in Endpoint fail-safe mode.");
-                } else {
-                    handleException("Endpoint configuration " + name + " cannot be built.");
-                }
+                String msg = "Endpoint configuration : " + name + " cannot be built";
+                handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_EP, msg, e);
             }
             return endpoint;
         } else {
-            if (failSafeEpEnabled) {
-                log.warn("Invalid endpoint definition without a name");
-                log.warn("Continue in Endpoint fail-safe mode.");
-            } else {
-                handleException("Invalid endpoint definition without a name");
-            }
+            String msg = "Invalid endpoint definition without a name";
+            handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_SEQUENCES, msg);
         }
         return null;
     }
 
     public static SynapseEventSource defineEventSource(SynapseConfiguration config,
                                                        OMElement elem, Properties properties) {
-        boolean failSafeEventSourcesEnabled = isFailSafeEnabled(
-                SynapseConstants.FAIL_SAFE_MODE_EVENT_SOURCE);
+
         SynapseEventSource eventSource = null;
 
         try {
@@ -301,20 +246,14 @@ public class SynapseXMLConfigurationFact
                 config.addEventSource(eventSource.getName(), eventSource);
             }
         } catch (Exception e) {
-            if (failSafeEventSourcesEnabled) {
-                log.warn("Event Source configuration cannot be built.", e);
-                log.warn("Continue in Event Source fail-safe mode.");
-            } else {
-                handleException("Event Source configuration cannot be built.");
-            }
+            String msg = "Event Source configuration cannot be built";
+            handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_EVENT_SOURCE, msg, e);
         }
         return eventSource;
     }
 
     public static PriorityExecutor defineExecutor(SynapseConfiguration config,
                                                        OMElement elem, Properties properties) {
-        boolean failSafeExecutorsEnabled = isFailSafeEnabled(
-                SynapseConstants.FAIL_SAFE_MODE_EXECUTORS);
 
         PriorityExecutor executor = null;
         try {
@@ -323,12 +262,8 @@ public class SynapseXMLConfigurationFact
             assert executor != null;
             config.addPriorityExecutor(executor.getName(), executor);
         } catch (AxisFault axisFault) {
-            if (failSafeExecutorsEnabled) {
-                log.warn("Executor configuration cannot be built.");
-                log.warn("Continue in Executor fail-safe mode.");
-            } else {
-                handleException("Failed to create the priority-executor configuration");
-            }            
+            String msg = "Executor configuration cannot be built";
+            handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_EXECUTORS, msg, axisFault);
         }
         return executor;
     }
@@ -349,8 +284,7 @@ public class SynapseXMLConfigurationFact
 
     public static Template defineEndpointTemplate(SynapseConfiguration config,
                                                     OMElement elem, Properties properties) {
-        boolean failSafeExecutorsEnabled = isFailSafeEnabled(
-                SynapseConstants.FAIL_SAFE_MODE_TEMPLATES);
+
         TemplateFactory templateFactory = new TemplateFactory();
         String name = elem.getAttributeValue(new QName(XMLConfigConstants.NULL_NAMESPACE, "name"));
         try {
@@ -360,12 +294,8 @@ public class SynapseXMLConfigurationFact
             }
             return template;
         } catch (Exception e) {
-            if (failSafeExecutorsEnabled) {
-                log.warn("Endpoint Template: " + name + "configuration cannot be built.", e);
-                log.warn("Continue in Endpoint Template fail-safe mode.");
-            } else {
-                handleException("Endpoint Template configuration cannot be built.");
-            }
+            String msg = "Endpoint Template: " + name + "configuration cannot be built";
+            handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_TEMPLATES, msg, e);
         }
         return null;
     }
@@ -399,17 +329,20 @@ public class SynapseXMLConfigurationFact
         return SynapseXMLConfigurationSerializer.class;
     }
 
-    private static boolean isFailSafeEnabled(String componentName) {
-        if (failSafeStr != null) {
-            String[] failSafeComponents = failSafeStr.split(",");
-            if (Arrays.<String>asList(failSafeComponents).indexOf(SynapseConstants.FAIL_SAFE_MODE_ALL) >= 0
-                    || Arrays.<String>asList(failSafeComponents).indexOf(componentName) >= 0) {
-                return true;
-            }
+    private static void handleConfigurationError(String componentType, String msg) {
+        if (SynapseConfigUtils.isFailSafeEnabled(componentType)) {
+            log.warn(msg + " - Continue in fail-safe mode");
         } else {
-            return true; // Enabled by default
+            handleException(msg);
         }
-        return false;
     }
 
+    private static void handleConfigurationError(String componentType, String msg, Exception e) {
+        if (SynapseConfigUtils.isFailSafeEnabled(componentType)) {
+            log.warn(msg + " - Continue in fail-safe mode", e);
+        } else {
+            log.error(msg, e);
+            throw new SynapseException(msg, e);
+        }
+    }
 }

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=1096547&r1=1096546&r2=1096547&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 18:08:06 2011
@@ -276,12 +276,6 @@ public class ProxyService implements Asp
             } 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()) {
@@ -635,22 +629,6 @@ 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=1096547&r1=1096546&r2=1096547&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 18:08:06 2011
@@ -24,13 +24,13 @@ import org.apache.axis2.deployment.Deplo
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.synapse.SynapseConstants;
+import org.apache.synapse.config.SynapseConfigUtils;
 import org.apache.synapse.config.xml.MultiXMLConfigurationBuilder;
 import org.apache.synapse.config.xml.ProxyServiceFactory;
 import org.apache.synapse.config.xml.ProxyServiceSerializer;
 import org.apache.synapse.core.axis2.ProxyService;
 
 import java.io.File;
-import java.util.Arrays;
 import java.util.Properties;
 
 /**
@@ -46,23 +46,9 @@ public class ProxyServiceDeployer extend
     @Override
     public String deploySynapseArtifact(OMElement artifactConfig, String fileName,
                                         Properties properties) {
-        boolean failSafeProxyEnabled = false;
-        try {
-            failSafeStr = getSynapseConfiguration().getProperty(SynapseConstants.FAIL_SAFE_MODE_STATUS);
-            if (failSafeStr != null) {
-                String[] failSafeComponents = failSafeStr.split(",");
-                if (Arrays.<String>asList(failSafeComponents).indexOf(SynapseConstants.FAIL_SAFE_MODE_ALL) >= 0
-                        || Arrays.<String>asList(failSafeComponents).indexOf(SynapseConstants.FAIL_SAFE_MODE_PROXY_SERVICES) >= 0) {
-                    failSafeProxyEnabled = true; 
-                }
-            } else {
-                failSafeProxyEnabled = true; // Enabled by default
-            }
-            
-        } catch (DeploymentException ignored) {
-
-        }
 
+        boolean failSafeProxyEnabled = SynapseConfigUtils.isFailSafeEnabled(
+                SynapseConstants.FAIL_SAFE_MODE_PROXY_SERVICES);
 
         if (log.isDebugEnabled()) {
             log.debug("ProxyService Deployment from file : " + fileName + " : Started");
@@ -99,8 +85,8 @@ public class ProxyServiceDeployer extend
             }
         } catch (Exception e) {
             if (failSafeProxyEnabled) {
-                log.warn("Proxy Service : " + fileName + " : Hot Deployment Failed - " + e.getMessage());
-                log.warn("Proxy Service : Fail-Safe mode.");
+                log.warn("Proxy service hot deployment from file: " + fileName + " failed - " +
+                        "Continue in fail-safe mode", e);
             } else {
                 handleSynapseArtifactDeploymentError(
                         "ProxyService Deployment from the file : " + fileName + " : Failed.", e);