ConcurrentModificationException in ScheduleModel.load on access to 'days' TreeMap ---------------------------------------------------------------------------------
Key: TOMAHAWK-674 URL: http://issues.apache.org/jira/browse/TOMAHAWK-674 Project: MyFaces Tomahawk Issue Type: Bug Components: Schedule Environment: all Reporter: Mikhail Grushinskiy Fix For: 1.1.4-SNAPSHOT, 1.1.5-SNAPSHOT, 1.1.3 ConcurrentModificationException in ScheduleModel.load on access to 'days' TreeMap AbstractSchedule model days TreeMap throws ConcurrentModificationException when accessed from two requests at same time. Caused by: java.util.ConcurrentModificationException at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1031) at java.util.TreeMap$KeyIterator.next(TreeMap.java:1058) at com.jsfapp.web.faces.bean.ScheduleModel.load(ScheduleModel.java:204) at com.jsfapp.web.faces.bean.ScheduleModel.setMonth(ScheduleModel.java:174) at org.apache.myfaces.custom.schedule.model.AbstractScheduleModel.setSelectedDate(AbstractScheduleModel.java:118) at org.apache.myfaces.custom.schedule.model.AbstractScheduleModel.refresh(AbstractScheduleModel.java:410) Consider using this: public static <K,V> SortedMap<K,V> synchronizedSortedMap(SortedMap<K,V> m) Returns a synchronized (thread-safe) sorted map backed by the specified sorted map. In order to guarantee serial access, it is critical that all access to the backing sorted map is accomplished through the returned sorted map (or its views). It is imperative that the user manually synchronize on the returned sorted map when iterating over any of its collection views, or the collections views of any of its subMap, headMap or tailMap views. SortedMap m = Collections.synchronizedSortedMap(new HashSortedMap()); ... Set s = m.keySet(); // Needn't be in synchronized block ... synchronized(m) { // Synchronizing on m, not s! Iterator i = s.iterator(); // Must be in synchronized block while (i.hasNext()) foo(i.next()); } or: SortedMap m = Collections.synchronizedSortedMap(new HashSortedMap()); SortedMap m2 = m.subMap(foo, bar); ... Set s2 = m2.keySet(); // Needn't be in synchronized block ... synchronized(m) { // Synchronizing on m, not m2 or s2! Iterator i = s.iterator(); // Must be in synchronized block while (i.hasNext()) foo(i.next()); } --MG -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira