I have a method that I would like to call. However, I\'m looking for a clean, simple way to kill it or force it to return if it is taking too long to execute.
You should take a look at these classes :
FutureTask, Callable, Executors
Here is an example :
public class TimeoutExample {
public static Object myMethod() {
// does your thing and taking a long time to execute
return someResult;
}
public static void main(final String[] args) {
Callable