Skip to content

Commit

Permalink
wjw465150 add socket performance
Browse files Browse the repository at this point in the history
  • Loading branch information
wjw465150 authored and ewhauser committed Sep 13, 2011
1 parent 3e8ac6e commit a688c61
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/redis/clients/jedis/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ public void connect() {
if (!isConnected()) {
try {
socket = new Socket();
//->@wjw_add
socket.setReuseAddress(true);
socket.setKeepAlive(true); //Will monitor the TCP connection is valid
socket.setTcpNoDelay(true); //Socket buffer Whetherclosed, to ensure timely delivery of data
socket.setSoLinger(true,0); //Control calls close () method, the underlying socket is closed immediately
//<-@wjw_add

socket.connect(new InetSocketAddress(host, port), timeout);
socket.setSoTimeout(timeout);
outputStream = new RedisOutputStream(socket.getOutputStream());
Expand Down

0 comments on commit a688c61

Please sign in to comment.