Author: markt
Date: Tue Jan  9 21:06:34 2018
New Revision: 1820701

URL: http://svn.apache.org/viewvc?rev=1820701&view=rev
Log:
Fix ConcurrentModificationException

Modified:
    tomcat/trunk/webapps/docs/changelog.xml
    tomcat/trunk/webapps/examples/WEB-INF/classes/async/Stockticker.java

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1820701&r1=1820700&r2=1820701&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Jan  9 21:06:34 2018
@@ -178,6 +178,11 @@
         in the stock ticker example Servlet. (markt)
       </fix>
       <fix>
+        <bug>61886</bug>: Prevent <code>ConcurrentModificationException</code>
+        when running the asynchronous stock ticker in the examples web
+        application. (markt)
+      </fix>
+      <fix>
         <bug>61910</bug>: Clarify the meaning of the <code>allowLinking</code>
         option in the documentation web application. (markt)
       </fix>

Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/async/Stockticker.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/async/Stockticker.java?rev=1820701&r1=1820700&r2=1820701&view=diff
==============================================================================
--- tomcat/trunk/webapps/examples/WEB-INF/classes/async/Stockticker.java 
(original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/async/Stockticker.java Tue 
Jan  9 21:06:34 2018
@@ -17,14 +17,15 @@
 package async;
 
 import java.text.DecimalFormat;
-import java.util.ArrayList;
+import java.util.List;
 import java.util.Random;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.atomic.AtomicInteger;
 
 public class Stockticker implements Runnable {
         public volatile boolean run = true;
         protected final AtomicInteger counter = new AtomicInteger(0);
-        final ArrayList<TickListener> listeners = new ArrayList<>();
+        final List<TickListener> listeners = new CopyOnWriteArrayList<>();
         protected volatile Thread ticker = null;
         protected volatile int ticknr = 0;
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to