geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r599114 - /geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/AsyncHttpClient.java
Date Wed, 28 Nov 2007 19:40:32 GMT
Author: jgenender
Date: Wed Nov 28 11:40:31 2007
New Revision: 599114

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

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=599114&r1=599113&r2=599114&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 11:40:31 2007
@@ -42,122 +42,218 @@
  */
 public class AsyncHttpClient {
 
-    /**
-     * The Constant DEFAULT_CONNECTION_TIMEOUT.
-     */
+    /** The Constant DEFAULT_CONNECTION_TIMEOUT. */
     public static final int DEFAULT_CONNECTION_TIMEOUT = 30000;
 
-    /**
-     * The Constant DEFAULT_SSL_PROTOCOL.
-     */
+    /** The Constant DEFAULT_SSL_PROTOCOL. */
     public static final String DEFAULT_SSL_PROTOCOL = "TLS";
 
-    /**
-     * The ssl protocol.
-     */
+    /** The Default Reuse Address. */
+    private static final boolean DEFAULT_REUSE_ADDRESS = false;
+
+    /** The Default Receive Buffer Size. */
+    private static final int DEFAULT_RECEIVE_BUFFER_SIZE = 1024;
+
+    /** The Default Send Buffer Size. */
+    private static final int DEFAULT_SEND_BUFFER_SIZE = 1024;
+
+    /** The Default Traffic Class  */
+    private static final int DEFAULT_TRAFFIC_CLASS = 0;
+
+    /** The Default Keep Alive. */
+    private static final boolean DEFAULT_KEEP_ALIVE = false;
+
+    /** The Default OOB Inline. */
+    private static final boolean DEFAULT_OOB_INLINE = false;
+
+    /** The Default SO Linger. */
+    private static final int DEFAULT_SO_LINGER = -1;
+
+    /** The Default TCP No Delay. */
+    private static final boolean DEFAULT_TCP_NO_DELAY = false;
+
+    /** The SSL protocol. */
     private String sslProtocol = DEFAULT_SSL_PROTOCOL;
 
-    /**
-     * The connection timeout.
-     */
+    /** The connection timeout. */
     private int connectionTimeout = DEFAULT_CONNECTION_TIMEOUT;
 
-    /**
-     * The connector.
-     */
+    /** The connector. */
     private SocketConnector connector;
 
-    /**
-     * The thread pool.
-     */
+    /** The thread pool. */
     private final ExecutorService threadPool;
 
-    /**
-     * The HttpIoHandler handler.
-     */
+    /** The HttpIoHandler handler. */
     private HttpIoHandler handler = new HttpIoHandler();
 
-    /**
-     * The ssl filter.
-     */
+    /** The ssl filter. */
     private SSLFilter sslFilter;
 
-    private boolean reuseAddress = false;
+    /** The Reuse Address Socket Parameter. */
+    private boolean reuseAddress = DEFAULT_REUSE_ADDRESS;
 
-    private int receiveBufferSize = 1024;
+    /** The Receive Buffer Size Socket Parameter. */
+    private int receiveBufferSize = DEFAULT_RECEIVE_BUFFER_SIZE;
 
-    private int sendBufferSize = 1024;
+    /** The Send Buffer Size Socket Parameter. */
+    private int sendBufferSize = DEFAULT_SEND_BUFFER_SIZE;
 
-    private int trafficClass = 0;
+    /** The Traffic Class Socket Parameter. */
+    private int trafficClass = DEFAULT_TRAFFIC_CLASS;
 
-    private boolean keepAlive = false;
+    /** The Keep Alive Socket Parameter. */
+    private boolean keepAlive = DEFAULT_KEEP_ALIVE;
 
-    private boolean oobInline = false;
+    /** The OOB Inline Socket Parameter. */
+    private boolean oobInline = DEFAULT_OOB_INLINE;
 
-    private int soLinger = -1;
+    /** The Default SO Linger Socket Parameter. */
+    private int soLinger = DEFAULT_SO_LINGER;
 
-    private boolean tcpNoDelay = false;
+    /** The TCP No Delay Socket Parameter. */
+    private boolean tcpNoDelay = DEFAULT_TCP_NO_DELAY;
 
+    /**
+     * Checks if is reuse address.
+     * 
+     * @return true, if is reuse address
+     */
     public boolean isReuseAddress() {
         return reuseAddress;
     }
 
+    /**
+     * Sets the reuse address.
+     * 
+     * @param reuseAddress the new reuse address
+     */
     public void setReuseAddress(boolean reuseAddress) {
         this.reuseAddress = reuseAddress;
     }
 
+    /**
+     * Gets the receive buffer size.
+     * 
+     * @return the receive buffer size
+     */
     public int getReceiveBufferSize() {
         return receiveBufferSize;
     }
 
+    /**
+     * Sets the receive buffer size.
+     * 
+     * @param receiveBufferSize the new receive buffer size
+     */
     public void setReceiveBufferSize(int receiveBufferSize) {
         this.receiveBufferSize = receiveBufferSize;
     }
 
+    /**
+     * Gets the send buffer size.
+     * 
+     * @return the send buffer size
+     */
     public int getSendBufferSize() {
         return sendBufferSize;
     }
 
+    /**
+     * Sets the send buffer size.
+     * 
+     * @param sendBufferSize the new send buffer size
+     */
     public void setSendBufferSize(int sendBufferSize) {
         this.sendBufferSize = sendBufferSize;
     }
 
+    /**
+     * Gets the traffic class.
+     * 
+     * @return the traffic class
+     */
     public int getTrafficClass() {
         return trafficClass;
     }
 
+    /**
+     * Sets the traffic class.
+     * 
+     * @param trafficClass the new traffic class
+     */
     public void setTrafficClass(int trafficClass) {
         this.trafficClass = trafficClass;
     }
 
+    /**
+     * Checks if is keep alive.
+     * 
+     * @return true, if is keep alive
+     */
     public boolean isKeepAlive() {
         return keepAlive;
     }
 
+    /**
+     * Sets the keep alive.
+     * 
+     * @param keepAlive the new keep alive
+     */
     public void setKeepAlive(boolean keepAlive) {
         this.keepAlive = keepAlive;
     }
 
+    /**
+     * Checks if is oob inline.
+     * 
+     * @return true, if is oob inline
+     */
     public boolean isOobInline() {
         return oobInline;
     }
 
+    /**
+     * Sets the oob inline.
+     * 
+     * @param oobInline the new oob inline
+     */
     public void setOobInline(boolean oobInline) {
         this.oobInline = oobInline;
     }
 
+    /**
+     * Gets the so linger.
+     * 
+     * @return the so linger
+     */
     public int getSoLinger() {
         return soLinger;
     }
 
+    /**
+     * Sets the so linger.
+     * 
+     * @param soLinger the new so linger
+     */
     public void setSoLinger(int soLinger) {
         this.soLinger = soLinger;
     }
 
+    /**
+     * Checks if is tcp no delay.
+     * 
+     * @return true, if is tcp no delay
+     */
     public boolean isTcpNoDelay() {
         return tcpNoDelay;
     }
 
+    /**
+     * Sets the tcp no delay.
+     * 
+     * @param tcpNoDelay the new tcp no delay
+     */
     public void setTcpNoDelay(boolean tcpNoDelay) {
         this.tcpNoDelay = tcpNoDelay;
     }
@@ -173,7 +269,7 @@
     /**
      * Instantiates a new AsyncHttpClient.  This will take a thread pool (ExecutorService)
to use
      * for processing connections.
-     *
+     * 
      * @param executor the executor
      */
     public AsyncHttpClient(ExecutorService executor) {
@@ -183,7 +279,7 @@
     /**
      * Instantiates a new AsyncHttpClient.  Uses a single thread model by default and allows
you to specify
      * a connection timeout.
-     *
+     * 
      * @param connectionTimeout the connection timeout in milliseconds.
      */
     public AsyncHttpClient(int connectionTimeout) {
@@ -192,7 +288,7 @@
 
     /**
      * Instantiates a new AsyncHttpClient.  Allows you to specify a connection timeout and
an ExecutorService.
-     *
+     * 
      * @param connectionTimeout the connection timeout in milliseconds.
      * @param executor          the ExceutorService to use to process connections.
      */
@@ -215,8 +311,9 @@
 
     /**
      * Sends a request.
-     *
+     * 
      * @param message the <code>HttpRequestMessage</code> to send to the remote
server.
+     * 
      * @see HttpRequestMessage
      */
     public void sendRequest(HttpRequestMessage message) {
@@ -231,7 +328,7 @@
 
     /**
      * Gets the connection timeout.
-     *
+     * 
      * @return the connection timeout in milliseconds
      */
     public int getConnectionTimeout() {
@@ -240,7 +337,7 @@
 
     /**
      * Sets the connection timeout.
-     *
+     * 
      * @param connectionTimeout the new connection timeout in milliseconds
      */
     public void setConnectionTimeout(int connectionTimeout) {
@@ -249,6 +346,9 @@
         applyConnectionTimeout();
     }
 
+    /**
+     * Apply connection timeout.
+     */
     private void applyConnectionTimeout() {
         connector.getDefaultConfig().setConnectTimeout(connectionTimeout / 1000);
     }
@@ -277,19 +377,15 @@
      */
     class FutureListener implements IoFutureListener {
 
-        /**
-         * The request.
-         */
+        /** The request. */
         HttpRequestMessage request;
 
-        /**
-         * The client.
-         */
+        /** The client. */
         AsyncHttpClient client;
 
         /**
          * Instantiates a new future listener for a connection.
-         *
+         * 
          * @param client  the <code>AsyncHttpClient</code> client object
          * @param request the <code>HttpRequestMessage</code> request that is
to be sent.
          */
@@ -301,8 +397,9 @@
         /**
          * Event notification that the conection has completed, either by a successful connection
or
          * by an error.
-         *
+         * 
          * @param future the {@link org.apache.mina.common.IoFuture} representing the <code>ConnectFuture</code>.
+         * 
          * @see org.apache.mina.common.IoFutureListener#operationComplete(org.apache.mina.common.IoFuture)
          */
         public void operationComplete(IoFuture future) {
@@ -321,7 +418,7 @@
                             try {
                                 sess.getHandler().exceptionCaught(sess, e);
                             } catch (Exception e1) {
-                                //Do nothing...we are just reported it
+                                //Do nothing...we just reported it
                             }
                         }
                     }
@@ -336,7 +433,7 @@
                 sess.setAttachment(client);
 
                 //Set the socket parameters on successfully obtaining the session
-                SocketSessionConfig config = (SocketSessionConfig)sess.getConfig();
+                SocketSessionConfig config = (SocketSessionConfig) sess.getConfig();
                 config.setKeepAlive(keepAlive);
                 config.setOobInline(oobInline);
                 config.setReceiveBufferSize(receiveBufferSize);
@@ -360,8 +457,9 @@
 
         /**
          * Creates the client ssl context.
-         *
+         * 
          * @return the SSL context
+         * 
          * @throws GeneralSecurityException the general security exception
          */
         private SSLContext createClientSSLContext() throws GeneralSecurityException {



Mime
View raw message