tianshuang,

On 10/23/21 23:44, Poison wrote:
Tomcat version: 8.5.72


org.apache.tomcat.util.threads.TaskQueue source 
code: https://github.com/apache/tomcat/blob/8.5.72/java/org/apache/tomcat/util/threads/TaskQueue.java#L33


In the comments of the TaskQueue class, it mentions "If you use a normal 
queue, the executor will spawn threads when there are idle threads and you wont be able to force 
items onto the queue itself.". But when we use 
java.util.concurrent.LinkedBlockingQueue, it will be put into the queue by default instead of 
creating threads. What queue does the normal queue in the comment refer to?

Just looking at the class definition, I think "normal queue" means "an instance of another subclass of BlockingQueue<Runnable>".

The TaskQueue class has a "force" method which does something like "offer" but behaves differently. Tomcat can use this internally instead of having to only use the more limited "offer" method of the Queue interface.

-chris

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

Reply via email to