You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2006/12/21 19:29:13 UTC

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

Author: mriou
Date: Thu Dec 21 10:29:13 2006
New Revision: 489430

URL: http://svn.apache.org/viewvc?view=rev&rev=489430
Log:
Protecting against concurrent modifications.

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

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java?view=diff&rev=489430&r1=489429&r2=489430
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java Thu Dec 21 10:29:13 2006
@@ -318,17 +318,24 @@
             try {
                 while (true) {
                     Thread.sleep(10000);
-                    for (BpelProcess process : _activeProcesses.values()) {
-                        Long lru;
-                        synchronized(_processesLRU) {
-                            lru = _processesLRU.get(process._pid);
+                    try {
+                        for (BpelProcess process : _activeProcesses.values()) {
+                            Long lru;
+                            synchronized(_processesLRU) {
+                                lru = _processesLRU.get(process._pid);
+                            }
+                            if (lru != null && process._oprocess != null
+                                    && System.currentTimeMillis() - lru > _processMaxAge) {
+                                process._oprocess = null;
+                                __log.debug("Process definition reaper cleaning " + process._pid);
+                            }
+                            Thread.sleep(10);
                         }
-                        if (lru != null && process._oprocess != null
-                                && System.currentTimeMillis() - lru > _processMaxAge) {
-                            process._oprocess = null;
-                            __log.debug("Process definition reaper cleaning " + process._pid);
-                        }
-                        Thread.sleep(10);
+                    } catch (ConcurrentModificationException cme) {
+                        // A concurrent modification could happen once in a while, it's not really a
+                        // problem as we'll try again 10s later.
+                        __log.debug("Concurrent modification exception while trying to reap process definitions, " +
+                                "will try again in a few seconds.");
                     }
                 }
             } catch (InterruptedException e) {