You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mi...@apache.org on 2009/09/10 18:41:29 UTC

svn commit: r813508 - /ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java

Author: midon
Date: Thu Sep 10 16:41:26 2009
New Revision: 813508

URL: http://svn.apache.org/viewvc?rev=813508&view=rev
Log:
ODE-568: deactivate endpoints only if the process is active

Modified:
    ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java

Modified: ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java?rev=813508&r1=813507&r2=813508&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java (original)
+++ ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java Thu Sep 10 16:41:26 2009
@@ -591,22 +591,27 @@
     }
 
     void deactivate() {
-        // Deactivate all the my-role endpoints.
-        for (Endpoint endpoint : _myEprs.keySet()) {
-            // Deactivate the EPR only if there are no more references
-            // to this endpoint from any (active) BPEL process.
-            if (isShareable(endpoint)) {
-                __log.debug("deactivating shared endpoint " + endpoint);
-                if (!_sharedEps.decrementReferenceCount(endpoint)) {
+        // the BindingContext contains only the endpoints for the latest process version
+        if (org.apache.ode.bpel.iapi.ProcessState.ACTIVE.equals(_pconf.getState())) {
+            // Deactivate all the my-role endpoints.
+            for (Endpoint endpoint : _myEprs.keySet()) {
+                // Deactivate the EPR only if there are no more references
+                // to this endpoint from any (active) BPEL process.
+                if (isShareable(endpoint)) {
+                    if(__log.isDebugEnabled()) __log.debug("deactivating shared endpoint " + endpoint+ " for pid "+ _pid);
+                    if (!_sharedEps.decrementReferenceCount(endpoint)) {
+                        _engine._contexts.bindingContext.deactivateMyRoleEndpoint(endpoint);
+                        _sharedEps.removeEndpoint(endpoint);
+                    }
+                } else {
+                    if(__log.isDebugEnabled()) __log.debug("deactivating non-shared endpoint " + endpoint + " for pid "+ _pid);
                     _engine._contexts.bindingContext.deactivateMyRoleEndpoint(endpoint);
-                    _sharedEps.removeEndpoint(endpoint);
                 }
-            } else {
-                __log.debug("deactivating non-shared endpoint " + endpoint);
-                _engine._contexts.bindingContext.deactivateMyRoleEndpoint(endpoint);
             }
+            // TODO Deactivate all the partner-role channels
+        } else {
+            if(__log.isDebugEnabled()) __log.debug("pid "+_pid+" is not ACTIVE, no endpoints to deactivate");
         }
-        // TODO Deactivate all the partner-role channels
     }
 
     private boolean isShareable(Endpoint endpoint) {