I am trying to stop a long running method after 10 seconds of execution, so far i followed the timer instructions on baeldung. https://www.baeldung.com/java-stop-execution-after-certain-time#1-using-a-timer When the method is a simple call to a thread sleep it works, but when I call my function with sub methods it doesn’t stop. My implementation looks like this: And the way I am calling