diff --git a/src/main/java/net/schmizz/concurrent/Promise.java b/src/main/java/net/schmizz/concurrent/Promise.java index 7511648d0..06b4a8353 100644 --- a/src/main/java/net/schmizz/concurrent/Promise.java +++ b/src/main/java/net/schmizz/concurrent/Promise.java @@ -176,6 +176,7 @@ public V tryRetrieve(long timeout, TimeUnit unit) } 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 4ff892a05..05e771f73 100644 --- a/src/main/java/net/schmizz/keepalive/KeepAlive.java +++ b/src/main/java/net/schmizz/keepalive/KeepAlive.java @@ -75,6 +75,8 @@ public void run() { 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 85f0024d0..ee03d23cd 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 int read(byte[] b, int off, int len) 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 8839f1e53..d20853e8b 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 long awaitExpansion(long was) throws ConnectionException { throw new ConnectionException("Timeout when trying to expand the window size"); } } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); throw new ConnectionException(ie); } }