I am launching a long process in al web request in Spring MVC and I would like to terminate it if the thread takes a long time. Are there anyway to set a maximum time to kill the thread in a Spring controller if it is too long? Is this the best approach or are there any other better way to do it? I read here that the thread can not be killed by the app-server without the colaboration of the thread.
I found Guava TimeLimiter but not sure how to use it.
Thanks.