I have a servlet that takes a couple of minutes to process and return its response. It is running in a somewhat restricted environment (Amazon Elastic Beanstalk). In this environment, there is a 60 second limit on request times and that is not configurable.
What are my options here? I thought of having the servlet start a thread and have the browser poll with AJAX, but I have seen so many people recommend against servlets starting threads for various reasons.
Another solution would be to have a thread start and end in the application's context listener, but I have many different servlets in the app that perform various functions, all of which have the same issue. A single thread running in the background would not really help.
Any suggestions?
Edit: With a little bit of more research in SO, I found that an Executor is what I need.