You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2009/07/30 10:45:59 UTC

svn commit: r799204 - /myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationManager.java

Author: skitching
Date: Thu Jul 30 08:45:58 2009
New Revision: 799204

URL: http://svn.apache.org/viewvc?rev=799204&view=rev
Log:
Fix ConcurrentModificationException when an HttpSession containing an orchestra conversation times out.
Using iterator.next just doesn't work here...

Modified:
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationManager.java

Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationManager.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationManager.java?rev=799204&r1=799203&r2=799204&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationManager.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationManager.java Thu Jul 30 08:45:58 2009
@@ -26,7 +26,6 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Collection;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -675,15 +674,20 @@
 
     private void removeAndInvalidateConversationContextAndChildren(ConversationContext conversationContext)
     {
-        Collection childs = conversationContext.getChildren();
-        for (Iterator it = childs.iterator(); it.hasNext();)
+        while (conversationContext.hasChildren())
         {
-            removeAndInvalidateConversationContextAndChildren((ConversationContext) it.next());
+            // Get first child
+            ConversationContext child = (ConversationContext) conversationContext.getChildren().iterator().next();
+
+            // This call removes child from conversationContext.children
+            removeAndInvalidateConversationContextAndChildren(child);
         }
+
         if (log.isDebugEnabled())
         {
             log.debug("end conversation context: " + conversationContext.getId());
         }
+
         removeAndInvalidateConversationContext(conversationContext);
     }