You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by vi...@apache.org on 2015/10/23 20:36:17 UTC
svn commit: r1710277 - in /tomcat/tc7.0.x/trunk:
java/org/apache/naming/resources/WARDirContext.java
webapps/docs/changelog.xml
Author: violetagg
Date: Fri Oct 23 18:36:17 2015
New Revision: 1710277
URL: http://svn.apache.org/viewvc?rev=1710277&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58522
Fixed concurrency issue when iterating web application's resources.
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/WARDirContext.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Modified: tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/WARDirContext.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/WARDirContext.java?rev=1710277&r1=1710276&r2=1710277&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/WARDirContext.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/WARDirContext.java Fri Oct 23 18:36:17 2015
@@ -760,7 +760,6 @@ public class WARDirContext extends BaseD
ArrayList<NamingEntry> entries = new ArrayList<NamingEntry>();
Entry[] children = entry.getChildren();
- Arrays.sort(children);
NamingEntry namingEntry = null;
for (int i = 0; i < children.length; i++) {
@@ -811,6 +810,9 @@ public class WARDirContext extends BaseD
protected Entry children[] = new Entry[0];
+ protected volatile boolean childrenSorted = false;
+
+
// ----------------------------------------------------- Public Methods
@@ -849,10 +851,19 @@ public class WARDirContext extends BaseD
newChildren[i] = children[i];
newChildren[children.length] = entry;
children = newChildren;
+ childrenSorted = false;
}
public Entry[] getChildren() {
+ if (!childrenSorted) {
+ synchronized (children) {
+ if (!childrenSorted) {
+ Arrays.sort(children);
+ childrenSorted = true;
+ }
+ }
+ }
return children;
}
Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1710277&r1=1710276&r2=1710277&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Oct 23 18:36:17 2015
@@ -58,6 +58,14 @@
issues do not "pop up" wrt. others).
-->
<section name="Tomcat 7.0.66 (violetagg)">
+ <subsection name="Catalina">
+ <changelog>
+ <fix>
+ <bug>58522</bug>: Fixed concurrency issue when iterating web
+ application's resources. (violetagg)
+ </fix>
+ </changelog>
+ </subsection>
<subsection name="Cluster">
<changelog>
<fix>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org