Author: markt
Date: Thu Sep 17 08:34:53 2015
New Revision: 1703523
URL: http://svn.apache.org/r1703523
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58389
Fix rare data race
Modified:
tomcat/trunk/java/org/apache/tomcat/util/threads/TaskQueue.java
Modified: tomcat/trunk/java/org/apache/tomcat/util/threads/TaskQueue.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/threads/TaskQueue.java?rev=1703523&r1=1703522&r2=1703523&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/threads/TaskQueue.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/threads/TaskQueue.java Thu Sep 17
08:34:53 2015
@@ -25,17 +25,17 @@ import java.util.concurrent.TimeUnit;
* As task queue specifically designed to run with a thread pool executor. The
* task queue is optimised to properly utilize threads within a thread pool
* executor. If you use a normal queue, the executor will spawn threads when
- * there are idle threads and you wont be able to force items unto the queue
+ * there are idle threads and you wont be able to force items onto the queue
* itself.
*/
public class TaskQueue extends LinkedBlockingQueue<Runnable> {
private static final long serialVersionUID = 1L;
- private ThreadPoolExecutor parent = null;
+ private volatile ThreadPoolExecutor parent = null;
- // no need to be volatile, the one times when we change and read it occur
in
- // a single thread (the one that did stop a context and fired listeners)
+ // No need to be volatile. This is written and read in a single thread
+ // (when stopping a context and firing the listeners)
private Integer forcedRemainingCapacity = null;
public TaskQueue() {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]