geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r599092 - /geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/AsyncHttpClient.java
Date Wed, 28 Nov 2007 18:49:45 GMT
Author: jgenender
Date: Wed Nov 28 10:49:44 2007
New Revision: 599092

URL: http://svn.apache.org/viewvc?rev=599092&view=rev
Log:
Add socket parameters

Modified:
    geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/AsyncHttpClient.java

Modified: geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/AsyncHttpClient.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/AsyncHttpClient.java?rev=599092&r1=599091&r2=599092&view=diff
==============================================================================
--- geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/AsyncHttpClient.java (original)
+++ geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/AsyncHttpClient.java Wed
Nov 28 10:49:44 2007
@@ -28,6 +28,7 @@
 import org.apache.mina.filter.SSLFilter;
 import org.apache.mina.filter.codec.ProtocolCodecFilter;
 import org.apache.mina.transport.socket.nio.SocketConnector;
+import org.apache.mina.transport.socket.nio.SocketSessionConfig;
 
 import javax.net.ssl.SSLContext;
 import java.net.InetSocketAddress;
@@ -81,6 +82,86 @@
      */
     private SSLFilter sslFilter;
 
+    private boolean reuseAddress = false;
+
+    private int receiveBufferSize = 1024;
+
+    private int sendBufferSize = 1024;
+
+    private int trafficClass = 0;
+
+    private boolean keepAlive = false;
+
+    private boolean oobInline = false;
+
+    private int soLinger = -1;
+
+    private boolean tcpNoDelay = false;
+
+    public boolean isReuseAddress() {
+        return reuseAddress;
+    }
+
+    public void setReuseAddress(boolean reuseAddress) {
+        this.reuseAddress = reuseAddress;
+    }
+
+    public int getReceiveBufferSize() {
+        return receiveBufferSize;
+    }
+
+    public void setReceiveBufferSize(int receiveBufferSize) {
+        this.receiveBufferSize = receiveBufferSize;
+    }
+
+    public int getSendBufferSize() {
+        return sendBufferSize;
+    }
+
+    public void setSendBufferSize(int sendBufferSize) {
+        this.sendBufferSize = sendBufferSize;
+    }
+
+    public int getTrafficClass() {
+        return trafficClass;
+    }
+
+    public void setTrafficClass(int trafficClass) {
+        this.trafficClass = trafficClass;
+    }
+
+    public boolean isKeepAlive() {
+        return keepAlive;
+    }
+
+    public void setKeepAlive(boolean keepAlive) {
+        this.keepAlive = keepAlive;
+    }
+
+    public boolean isOobInline() {
+        return oobInline;
+    }
+
+    public void setOobInline(boolean oobInline) {
+        this.oobInline = oobInline;
+    }
+
+    public int getSoLinger() {
+        return soLinger;
+    }
+
+    public void setSoLinger(int soLinger) {
+        this.soLinger = soLinger;
+    }
+
+    public boolean isTcpNoDelay() {
+        return tcpNoDelay;
+    }
+
+    public void setTcpNoDelay(boolean tcpNoDelay) {
+        this.tcpNoDelay = tcpNoDelay;
+    }
+
     /**
      * Instantiates a new AsyncHttpClient.  It will use a single threaded model and is good
for
      * use in one-off connections.
@@ -253,6 +334,17 @@
                 sess.setAttribute(HttpIoHandler.CURRENT_REQUEST, request);
 
                 sess.setAttachment(client);
+
+                //Set the socket parameters on successfully obtaining the session
+                SocketSessionConfig config = (SocketSessionConfig)sess.getConfig();
+                config.setKeepAlive(keepAlive);
+                config.setOobInline(oobInline);
+                config.setReceiveBufferSize(receiveBufferSize);
+                config.setReuseAddress(reuseAddress);
+                config.setSendBufferSize(sendBufferSize);
+                config.setSoLinger(soLinger);
+                config.setTcpNoDelay(tcpNoDelay);
+                config.setTrafficClass(trafficClass);
 
                 sess.write(request);
             } else {



Mime
View raw message