Skip to content

Tag: interrupted-exception

Spring Retryable – Async context

Have an issue with @Retryable in the Async context, I have a service call which is returning a SocketTimeOut exception. This I would have expected to retry 3 times, I do have @EnableRetry, however I am seeing something I little strange in the logs, a sleep interruptedException. Here is part of the stack trace. Caused by: java.lang.InterruptedException: sleep interrupted at

Thread is interrupted by calling interrupt(), but Thread.isInterrupted() returns false

I am testing InterruptedException with the following test code: In run() , I interrupt() current working thread, and caught a InterruptedException. In main thread, my last line of code is a System.out.println(…) which prints out the interrupt status of working thread. Since I have caught InterruptedException in run(), I though I should get the message that workingThread.isInterrupted() is true, but

Interrupting looped threads in Java

I’m trying to understand how threads work in Java and currently investigating how to implement looped threads that can be cancelled. Here’s the code: The thread I create is indended to be interrupted sooner or later. So, I check isInterrupted() flag to decide whether I need to go on and also catch InterruptedException to handle cases when I’m in a