From 33ceb6da0fe60583b7e67bceda7e475ebe9a173a Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Tue, 15 Feb 2011 20:51:36 -0500 Subject: [PATCH] set keepAlive on pub/sub sockets (infinite timeout) in case we don't see the connection close --- src/main/java/redis/clients/jedis/Connection.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/redis/clients/jedis/Connection.java b/src/main/java/redis/clients/jedis/Connection.java index 4136fd3..bdb5d02 100644 --- a/src/main/java/redis/clients/jedis/Connection.java +++ b/src/main/java/redis/clients/jedis/Connection.java @@ -34,6 +34,7 @@ public class Connection { public void setTimeoutInfinite() { try { + socket.setKeepAlive(true); socket.setSoTimeout(0); } catch (SocketException ex) { throw new JedisException(ex); @@ -43,6 +44,7 @@ public class Connection { public void rollbackTimeout() { try { socket.setSoTimeout(timeout); + socket.setKeepAlive(false); } catch (SocketException ex) { throw new JedisException(ex); }