Author: supun
Date: Wed Apr 20 05:57:22 2011
New Revision: 1095278

URL: http://svn.apache.org/viewvc?rev=1095278&view=rev
Log:
applying patch SYNAPSE-753, thanks Udayanga for the contribution

Modified:
    
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
    
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/TemplateEndpoint.java

Modified: 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java?rev=1095278&r1=1095277&r2=1095278&view=diff
==============================================================================
--- 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
 (original)
+++ 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
 Wed Apr 20 05:57:22 2011
@@ -276,6 +276,27 @@ public class SynapseConfiguration implem
         return definedTemplates;
     }
 
+    /**
+     * Returns the map of defined synapse endpoint templates in the 
configuration excluding the
+     * fetched sequences from remote registry.
+     *
+     * @return Map of Templates defined in the local configuration
+     */
+    public Map<String, Template> getEndpointTemplates() {
+
+        Map<String, Template> definedTemplates = new HashMap<String, 
Template>();
+
+        synchronized (this) {
+            for (Object o : localRegistry.values()) {
+                if (o instanceof Template) {
+                    Template template = (Template) o;
+                    definedTemplates.put(template.getName(), template);
+                }
+            }
+        }
+        return definedTemplates;
+    }
+
      /**
      * Return the template specified with the given key
      *

Modified: 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/TemplateEndpoint.java
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/TemplateEndpoint.java?rev=1095278&r1=1095277&r2=1095278&view=diff
==============================================================================
--- 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/TemplateEndpoint.java
 (original)
+++ 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/TemplateEndpoint.java
 Wed Apr 20 05:57:22 2011
@@ -104,6 +104,7 @@ public class TemplateEndpoint extends Ab
     private synchronized void reLoadAndInitEndpoint(SynapseEnvironment se) {
         SynapseConfiguration synCfg = se.getSynapseConfiguration();
 
+        //always do reloading at init
         boolean reLoad = (realEndpoint == null);
         if (!reLoad) {
             Entry entry = synCfg.getEntryDefinition(template);
@@ -112,8 +113,11 @@ public class TemplateEndpoint extends Ab
                     reLoad = true;
                 }
             } else {
-                // If the endpoint is static we should reload it from the 
Synapse config
-                reLoad = true;
+                // this endpoint is static -->
+                // since template-endpoint is static, should ONLY be loaded at 
initialization to prevent
+                // reloading every single time this endpoint is executed..
+                // incase tempalate config has changed this endpoint should be 
redeployed
+                reLoad = false;
             }
         }
 


Reply via email to