set keepAlive on pub/sub sockets (infinite timeout) in case we don't see the connection close
This commit is contained in:
@@ -34,6 +34,7 @@ public class Connection {
|
|||||||
|
|
||||||
public void setTimeoutInfinite() {
|
public void setTimeoutInfinite() {
|
||||||
try {
|
try {
|
||||||
|
socket.setKeepAlive(true);
|
||||||
socket.setSoTimeout(0);
|
socket.setSoTimeout(0);
|
||||||
} catch (SocketException ex) {
|
} catch (SocketException ex) {
|
||||||
throw new JedisException(ex);
|
throw new JedisException(ex);
|
||||||
@@ -43,6 +44,7 @@ public class Connection {
|
|||||||
public void rollbackTimeout() {
|
public void rollbackTimeout() {
|
||||||
try {
|
try {
|
||||||
socket.setSoTimeout(timeout);
|
socket.setSoTimeout(timeout);
|
||||||
|
socket.setKeepAlive(false);
|
||||||
} catch (SocketException ex) {
|
} catch (SocketException ex) {
|
||||||
throw new JedisException(ex);
|
throw new JedisException(ex);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user