From 3ce7c2ebfb9c014a834d6e7aa626c19a496bd24b Mon Sep 17 00:00:00 2001 From: gatesking Date: Wed, 30 Nov 2016 09:30:57 +0800 Subject: [PATCH] Catch interrupt signal in keepalive thread Interrupt signal may be catched when keepalive thread is sleeping. As a result, it will still go into conn.getTransport().die(e). --- src/main/java/net/schmizz/keepalive/KeepAlive.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/net/schmizz/keepalive/KeepAlive.java b/src/main/java/net/schmizz/keepalive/KeepAlive.java index c5972c5f8..8490c6512 100644 --- a/src/main/java/net/schmizz/keepalive/KeepAlive.java +++ b/src/main/java/net/schmizz/keepalive/KeepAlive.java @@ -65,6 +65,8 @@ public void run() { } Thread.sleep(hi * 1000); } + } catch (InterruptedException e) { + // Interrupt signal may be catched when sleeping. } catch (Exception e) { // If we weren't interrupted, kill the transport, then this exception was unexpected. // Else we're in shutdown-mode already, so don't forcibly kill the transport.