Author: hoang_to
Date: 2010-02-08 00:28:14 -0500 (Mon, 08 Feb 2010)
New Revision: 1545
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java
Log:
GTNPORTAL-599: ConcurrentModificationException exception while shutdown Tomcat
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java
===================================================================
---
portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java 2010-02-08
04:16:23 UTC (rev 1544)
+++
portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java 2010-02-08
05:28:14 UTC (rev 1545)
@@ -187,12 +187,22 @@
availableScriptsPaths_.remove(contextPath + key.getScriptPath());
object_view_of_merged_JS.remove(contextPath);
+ //Minh Hoang TO: Use 2 loops to avoid concurrent exception on fail-fast iterator
+ List<Entry<JavascriptKey, ServletContext>> entries_to_remove = new
ArrayList<Entry<JavascriptKey, ServletContext>>();
+
+ //TODO: We sould not use directly java.util.Map.Entry here, as it is impossible to
define an array of java.util.Map.Entry
for (Entry<JavascriptKey, ServletContext> entry : availableScriptsKey_)
{
if (key.equals(entry.getKey())
&&
scontext.getServletContextName().equals(entry.getValue().getServletContextName()))
- availableScriptsKey_.remove(entry);
+ entries_to_remove.add(entry);
}
+
+ //Remove the entries
+ for (Entry<JavascriptKey, ServletContext> entry_to_remove :
entries_to_remove)
+ {
+ availableScriptsKey_.remove(entry_to_remove);
+ }
}
/** Refresh the mergedJavascript **/
Show replies by date