You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2012/01/11 01:15:31 UTC

svn commit: r1229820 - /myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java

Author: lu4242
Date: Wed Jan 11 00:15:30 2012
New Revision: 1229820

URL: http://svn.apache.org/viewvc?rev=1229820&view=rev
Log:
MYFACES-3442 Infinite loop when calling ApplicationImpl._handleListenerForAnnotations under heavy load

Modified:
    myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java

Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java?rev=1229820&r1=1229819&r2=1229820&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java (original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java Wed Jan 11 00:15:30 2012
@@ -187,7 +187,7 @@ public class ApplicationImpl extends App
     private final Map<Class<? extends SystemEvent>, SystemListenerEntry> _systemEventListenerClassMap
             = new ConcurrentHashMap<Class<? extends SystemEvent>, SystemListenerEntry>();
 
-    private final Map<String, String> _defaultValidatorsIds = new HashMap<String, String>();
+    private final Map<String, String> _defaultValidatorsIds = new ConcurrentHashMap<String, String>();
     
     private volatile Map<String, String> _cachedDefaultValidatorsIds = null;
     
@@ -203,14 +203,16 @@ public class ApplicationImpl extends App
 
     private volatile boolean _firstRequestProcessed = false;
     
+    // MYFACES-3442 If HashMap or other non thread-safe structure is used, it is
+    // possible to fall in a infinite loop under heavy load.
     private final Map<Class<?>, List<ListenerFor>> _classToListenerForMap
-            = new HashMap<Class<?>, List<ListenerFor>>() ;
+            = new ConcurrentHashMap<Class<?>, List<ListenerFor>>() ;
 
     private final Map<Class<?>, List<ResourceDependency>> _classToResourceDependencyMap
-            = new HashMap<Class<?>, List<ResourceDependency>>() ;
+            = new ConcurrentHashMap<Class<?>, List<ResourceDependency>>() ;
     
     private List<Class<? extends Converter>> _noArgConstructorConverterClasses 
-            = new ArrayList<Class<? extends Converter>>();
+            = new CopyOnWriteArrayList<Class<? extends Converter>>();
     
     /** Value of javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE parameter */
     private boolean _dateTimeConverterDefaultTimeZoneIsSystemTimeZone = false;