I have a web app (java, tomcat) that allows users to generate reports through crystal reports. Problem is if a user requests a huge report that takes hours to complete, my whole app grinds to a halt. Is there a way to stop a request like this, say if after 5 minutes it has not been complete? Other than optimizing for speed and limiting report sizes, are there any other work-arounds?
Share
I think you are not running your report generation in another Thread. It is better to run the report generation in another Thread and send a link back to user when it is ready.
You can use ExecutorService of java and set some timeout for the thread and it will expire if it takes more than the time you have allocated for it.
Search for Java ExecutorService, Future, Callable tutorial
Sample code: