Multithreading – can I generate a thread from a servlet?
•
Java
Before turning to my main question, I'd like to ask a basic question
Let's say I'm running a simple java program that generates a thread in the main function Will the thread continue to run after the main function completes? The concept of whether there is a parent / child relationship between threads
I have a servlet that takes a long time to process requests (5 minutes) I can generate background threads from the main servlet to handle work and work I'll be back soon Will the background thread continue to run even if the main servlet has finished processing?
Solution
>There are parent - child threads, but you don't have much control For example, there is inheritablethreadlocal, where you can store variables of the thread hierarchy
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码