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 2010/04/26 09:53:51 UTC

svn commit: r937956 - /synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/AbstractRegistry.java

Author: hiranya
Date: Mon Apr 26 07:53:51 2010
New Revision: 937956

URL: http://svn.apache.org/viewvc?rev=937956&view=rev
Log:
Fixing SYNAPSE-625. When a dynamic resource is updated from the registry, the old resource is destroyed.


Modified:
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/AbstractRegistry.java

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/AbstractRegistry.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/AbstractRegistry.java?rev=937956&r1=937955&r2=937956&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/AbstractRegistry.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/AbstractRegistry.java Mon Apr 26 07:53:51 2010
@@ -102,6 +102,7 @@ public abstract class AbstractRegistry i
 
         // if we get here, we have received the raw omNode from the
         // registry and our previous copy (if we had one) has expired or is not valid
+        Object expiredValue = entry.getValue();
 
         // if we have a XMLToObjectMapper for this entry, use it to convert this
         // resource into the appropriate object - e.g. sequence or endpoint
@@ -133,6 +134,15 @@ public abstract class AbstractRegistry i
             }
         }
 
+        if (expiredValue != null) {
+            // Destroy the old resource so that everything is properly cleaned up
+            if (expiredValue instanceof SequenceMediator) {
+                ((SequenceMediator) expiredValue).destroy();
+            } else if (expiredValue instanceof Endpoint) {
+                ((Endpoint) expiredValue).destroy();
+            }
+        }
+
         // increment cache expiry time as specified by the last getRegistryEntry() call
         if (re != null) {
             if (re.getCachableDuration() > 0) {