Here is my use case.
- Client sends a request to server.
- The server need to do the following
2.a. Make a network call to get some data (D).
2.b. Create a processor (P) to process the data. - P processes D and sends the response back to client
Creating the processor is expensive (around the order of 1-3 seconds.) But it doesn't depend on the data D.
My plan is to execute the network call and creation of the processor in parallel using two different threads.
I've never done multithread programming inside an app server. My question is what is the best way to deal with threads inside an app server (specifically Tomcat and Jetty)
Thanks.