Main thread and tomcat


#1

Marco, can you explain a little more about whether tomcat uses the main thread in practice or if it generally starts another thread that blocks the main thread while it waits to handle incoming requests? Thanks!


#2

@brent_sullivan

Tomcat uses a dedicated thread pool to handle incoming requests, called “Executor” https://tomcat.apache.org/tomcat-8.0-doc/config/executor.html#Introduction . I cannot prove it, but I doubt that Tomcat is using the main thread (i.e. the thread you starting tomcat with) to do anything else besides that.


#3

Ah and what I forgot: No, Tomcat certainly doesn’t start another thread that blocks the main thread. THat’s what you have to do yourself, only the other way around.