set keepAlive on pub/sub sockets (infinite timeout) in case we don't see the connection close

This commit is contained in:
Steven Hugg
2011-02-15 20:51:36 -05:00
parent dad1b8c394
commit 33ceb6da0f

View File

@@ -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);
}