diff --git a/src/main/java/redis/clients/jedis/Connection.java b/src/main/java/redis/clients/jedis/Connection.java index 64e8de93d4..537f18ffb4 100644 --- a/src/main/java/redis/clients/jedis/Connection.java +++ b/src/main/java/redis/clients/jedis/Connection.java @@ -38,6 +38,7 @@ public void setTimeout(final int timeout) { public void setTimeoutInfinite() { try { + socket.setKeepAlive(true); socket.setSoTimeout(0); } catch (SocketException ex) { throw new JedisException(ex); @@ -47,6 +48,7 @@ public void setTimeoutInfinite() { public void rollbackTimeout() { try { socket.setSoTimeout(timeout); + socket.setKeepAlive(false); } catch (SocketException ex) { throw new JedisException(ex); }