I would like to set a time limit for script execution. In PHP I use "set_time_limit". How can I do this in JSP?
Asked
Active
Viewed 2,911 times
3 Answers
2
I have to disappoint you - there is no such setting. In JSP it is hardly feasible, when using servlets (especially 3.0) you have some options. However all of them require running your logic in a separate thread.
See my answer here, it is about Spring MVC, but it explains the general concept.

Community
- 1
- 1

Tomasz Nurkiewicz
- 334,321
- 69
- 703
- 674
0
Wrap the code you want to execute inside of java Runnable, then use ExecutorService to set a timeout for that task.
http://download.oracle.com/javase/1,5,0/docs/api/java/lang/Runnable.html http://download.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutorService.html

Hardip Singh
- 126
- 4