diff --git a/src/main/java/net/schmizz/concurrent/Promise.java b/src/main/java/net/schmizz/concurrent/Promise.java index 7511648d..06b4a835 100644 --- a/src/main/java/net/schmizz/concurrent/Promise.java +++ b/src/main/java/net/schmizz/concurrent/Promise.java @@ -176,6 +176,7 @@ public class Promise { } return val; } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); throw chainer.chain(ie); } finally { lock.unlock(); diff --git a/src/main/java/net/schmizz/keepalive/KeepAlive.java b/src/main/java/net/schmizz/keepalive/KeepAlive.java index 4ff892a0..05e771f7 100644 --- a/src/main/java/net/schmizz/keepalive/KeepAlive.java +++ b/src/main/java/net/schmizz/keepalive/KeepAlive.java @@ -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. diff --git a/src/main/java/net/schmizz/sshj/connection/channel/ChannelInputStream.java b/src/main/java/net/schmizz/sshj/connection/channel/ChannelInputStream.java index 85f0024d..ee03d23c 100644 --- a/src/main/java/net/schmizz/sshj/connection/channel/ChannelInputStream.java +++ b/src/main/java/net/schmizz/sshj/connection/channel/ChannelInputStream.java @@ -105,6 +105,7 @@ public final class ChannelInputStream try { buf.wait(); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw (IOException) new InterruptedIOException().initCause(e); } } diff --git a/src/main/java/net/schmizz/sshj/connection/channel/Window.java b/src/main/java/net/schmizz/sshj/connection/channel/Window.java index 8839f1e5..d20853e8 100644 --- a/src/main/java/net/schmizz/sshj/connection/channel/Window.java +++ b/src/main/java/net/schmizz/sshj/connection/channel/Window.java @@ -93,6 +93,7 @@ public abstract class Window { throw new ConnectionException("Timeout when trying to expand the window size"); } } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); throw new ConnectionException(ie); } }