You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ms...@apache.org on 2007/05/07 18:27:29 UTC

svn commit: r535917 - /incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java

Author: mszefler
Date: Mon May  7 09:27:23 2007
New Revision: 535917

URL: http://svn.apache.org/viewvc?view=rev&rev=535917
Log:
Fixed hydration synchronization.


Modified:
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java?view=diff&rev=535917&r1=535916&r2=535917
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java Mon May  7 09:27:23 2007
@@ -43,7 +43,9 @@
 import javax.xml.namespace.QName;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
@@ -72,8 +74,7 @@
     /** Maximum age of a process before it is quiesced */
     private static Long __processMaxAge;
 
-    private final List<BpelProcess> _runningProcesses =
-            Collections.synchronizedList(new ArrayList<BpelProcess>());
+    private final Set<BpelProcess> _runningProcesses = new HashSet<BpelProcess>();
 
     private State _state = State.SHUTDOWN;
     private Contexts _contexts = new Contexts();
@@ -250,7 +251,10 @@
             BpelProcess process = new BpelProcess(conf, null, this);
 
             _engine.registerProcess(process);
-            _runningProcesses.add(process);
+            
+            synchronized(_runningProcesses) {
+                _runningProcesses.add(process);
+            }
 
             __log.info(__msgs.msgProcessRegistered(conf.getProcessId()));
         } finally {
@@ -273,7 +277,9 @@
             BpelProcess p = null;
             if (_engine != null) {
                 _engine.unregisterProcess(pid);
-                _runningProcesses.remove(p);
+                synchronized(_runningProcesses) {
+                    _runningProcesses.remove(p);
+                }
             }
 
             __log.info(__msgs.msgProcessUnregistered(pid));
@@ -406,7 +412,9 @@
             }
         }
 
-        _runningProcesses.add(process);
+        synchronized (_runningProcesses) {
+            _runningProcesses.add(process);
+        }
     }
 
     private class ProcessDefReaper implements Runnable {
@@ -431,7 +439,9 @@
                         for (BpelProcess process : ripped) {
                             __log.debug("Dehydrating process " + process.getPID());
                             process.dehydrate();
-                            _runningProcesses.remove(process);
+                            synchronized (_runningProcesses) {
+                                _runningProcesses.remove(process);
+                            }
                         }
                     } finally {
                         _mngmtLock.writeLock().unlock();