restore the interrupt flag whenever we catch InterruptedException (#801)

Co-authored-by: Alex Heneveld <alex@cloudsoft.io>
This commit is contained in:
Alex Heneveld
2022-08-08 13:09:18 +01:00
committed by GitHub
parent 5674072666
commit 559384ac91
4 changed files with 5 additions and 0 deletions

View File

@@ -75,6 +75,8 @@ public abstract class KeepAlive extends Thread {
TimeUnit.SECONDS.sleep(interval);
}
} catch (InterruptedException e) {
// this is almost certainly a planned interruption, but even so, no harm in setting the interrupt flag
Thread.currentThread().interrupt();
log.trace("{} Interrupted while sleeping", getClass().getSimpleName());
} catch (Exception e) {
// If we weren't interrupted, kill the transport, then this exception was unexpected.