Tomcat: termination of streams that occur inside a stream request when closing an HTTP connection

In Tomcat 6/7:

1) Tell me in request-thread, we perform some tasks; Calling other web services, DB..etc. When the client closes the HTTP connection, does the request flow stop / terminate, stopping any running tasks? If not, how to complete?

2) What to do if we perform some parallel tasks in the request thread, spawning some new threads (using ExecutorService with a fixed pool size). In case of closing the HTTP connection, how to terminate / kill these streams generated inside the request-stream?

+4
source share
2 answers
+2

Tomcat minSpareThreads. , minSpareThreads.

MinSpareThreads
. , 10.

HTTP-, / , ?

. , Tomcat, , , . Tomcat -, , Tomcat CometEvent, link ( ).

, , , ( ), ( ). . 1) , "-", . 2) . , ​​ ( ) "stop". 1, , , . , "stop". ExecutorService, shutdownNow Thread.interrupt , .

+1

Source: https://habr.com/ru/post/1589101/


All Articles