File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,7 @@ boolean _open()
196
196
_socket .connect ( _addr , _options .connectTimeout );
197
197
198
198
_socket .setTcpNoDelay ( ! USE_NAGLE );
199
+ _socket .setKeepAlive ( _options .socketKeepAlive );
199
200
_socket .setSoTimeout ( _options .socketTimeout );
200
201
_in = new BufferedInputStream ( _socket .getInputStream () );
201
202
_out = _socket .getOutputStream ();
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ public void reset(){
35
35
maxWaitTime = 1000 * 60 * 2 ;
36
36
connectTimeout = 0 ;
37
37
socketTimeout = 0 ;
38
+ socketKeepAlive = false ;
38
39
autoConnectRetry = false ;
39
40
slaveOk = false ;
40
41
safe = false ;
@@ -94,6 +95,14 @@ else if (safe)
94
95
*/
95
96
public int socketTimeout ;
96
97
98
+ /**
99
+ * This controls whether or not to have socket keep alive
100
+ * turned on (SO_KEEPALIVE).
101
+ *
102
+ * defaults to false
103
+ */
104
+ public boolean socketKeepAlive ;
105
+
97
106
/**
98
107
* This controls whether the system retries automatically
99
108
* on connection errors.
@@ -155,6 +164,7 @@ public String toString(){
155
164
buf .append ( "maxWaitTime: " ).append ( maxWaitTime ).append ( " " );
156
165
buf .append ( "connectTimeout: " ).append ( connectTimeout ).append ( " " );
157
166
buf .append ( "socketTimeout: " ).append ( socketTimeout ).append ( " " );
167
+ buf .append ( "socketKeepAlive: " ).append ( socketKeepAlive ).append ( " " );
158
168
buf .append ( "autoConnectRetry: " ).append ( autoConnectRetry ).append ( " " );
159
169
buf .append ( "slaveOk: " ).append ( slaveOk ).append ( " " );
160
170
buf .append ( "safe: " ).append ( safe ).append ( " " );
You can’t perform that action at this time.
0 commit comments