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()
196196 _socket .connect ( _addr , _options .connectTimeout );
197197
198198 _socket .setTcpNoDelay ( ! USE_NAGLE );
199+ _socket .setKeepAlive ( _options .socketKeepAlive );
199200 _socket .setSoTimeout ( _options .socketTimeout );
200201 _in = new BufferedInputStream ( _socket .getInputStream () );
201202 _out = _socket .getOutputStream ();
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ public void reset(){
3535 maxWaitTime = 1000 * 60 * 2 ;
3636 connectTimeout = 0 ;
3737 socketTimeout = 0 ;
38+ socketKeepAlive = false ;
3839 autoConnectRetry = false ;
3940 slaveOk = false ;
4041 safe = false ;
@@ -94,6 +95,14 @@ else if (safe)
9495 */
9596 public int socketTimeout ;
9697
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+
97106 /**
98107 * This controls whether the system retries automatically
99108 * on connection errors.
@@ -155,6 +164,7 @@ public String toString(){
155164 buf .append ( "maxWaitTime: " ).append ( maxWaitTime ).append ( " " );
156165 buf .append ( "connectTimeout: " ).append ( connectTimeout ).append ( " " );
157166 buf .append ( "socketTimeout: " ).append ( socketTimeout ).append ( " " );
167+ buf .append ( "socketKeepAlive: " ).append ( socketKeepAlive ).append ( " " );
158168 buf .append ( "autoConnectRetry: " ).append ( autoConnectRetry ).append ( " " );
159169 buf .append ( "slaveOk: " ).append ( slaveOk ).append ( " " );
160170 buf .append ( "safe: " ).append ( safe ).append ( " " );
You can’t perform that action at this time.
0 commit comments