Here is my use case.
- The client sends a request to the server.
- The server needs 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 the client
Creating a processor is expensive (about 1-3 seconds). But this does not depend on the data D.
My plan is to make a network call and create a processor in parallel using two different threads.
I have never done multithreaded programming inside an application server. My question is the best way to handle threads inside the application server (in particular, Tomcat and Jetty).
Thank.
source
share