This question already has an answer here:
- Background timer task in JSP/Servlet web application [duplicate] 1 answer
I have the following problem:
I am writing a web application with servlets and JSP which should query a separate service. But the query takes a lot of time - around 30 seconds.
The structure of my app is simple - Filter->Controller->jsp. I was thinking what if in the filter I send the request into a separate thread to be processed while the controller goes on executing its job. What shall I do in order to make the querying process and controller processing simultaneous? + I need the query to be renewed every 5 mins (so that the user does have the relevant info). What is the optimum way to do that?