You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by as...@apache.org on 2007/05/29 13:37:29 UTC

svn commit: r542493 - in /webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp: ClientHandler.java HttpCoreNIOSender.java NHttpConfiguration.java ServerHandler.java

Author: asankha
Date: Tue May 29 04:37:28 2007
New Revision: 542493

URL: http://svn.apache.org/viewvc?view=rev&rev=542493
Log:
make the nhttp buffer size configurable
and sender socket timeout 60s (from 30)

Modified:
    webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/ClientHandler.java
    webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java
    webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/NHttpConfiguration.java
    webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/ServerHandler.java

Modified: webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/ClientHandler.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/ClientHandler.java?view=diff&rev=542493&r1=542492&r2=542493
==============================================================================
--- webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/ClientHandler.java (original)
+++ webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/ClientHandler.java Tue May 29 04:37:28 2007
@@ -67,6 +67,8 @@
 
     /** the Axis2 configuration context */
     ConfigurationContext cfgCtx = null;
+    /** the nhttp configuration */
+    private NHttpConfiguration cfg = null;
 
     private WorkerPool workerPool = null;
 
@@ -91,7 +93,7 @@
         this.httpProcessor = getHttpProcessor();
         this.connStrategy = new DefaultConnectionReuseStrategy();
 
-        NHttpConfiguration cfg = NHttpConfiguration.getInstance();
+        this.cfg = NHttpConfiguration.getInstance();
         workerPool = WorkerPoolFactory.getWorkerPool(
             cfg.getClientCoreThreads(),
             cfg.getClientMaxThreads(),
@@ -149,8 +151,8 @@
             context.setAttribute(HttpExecutionContext.HTTP_TARGET_HOST, axis2Req.getHttpHost());
 
             // allocate temporary buffers to process this request
-            context.setAttribute(REQUEST_BUFFER, ByteBuffer.allocate(2048));
-            context.setAttribute(RESPONSE_BUFFER, ByteBuffer.allocate(2048));
+            context.setAttribute(REQUEST_BUFFER, ByteBuffer.allocate(cfg.getBufferZise()));
+            context.setAttribute(RESPONSE_BUFFER, ByteBuffer.allocate(cfg.getBufferZise()));
 
             context.setAttribute(OUTGOING_MESSAGE_CONTEXT, axis2Req.getMsgContext());
             context.setAttribute(REQUEST_SOURCE_CHANNEL, axis2Req.getSourceChannel());

Modified: webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java?view=diff&rev=542493&r1=542492&r2=542493
==============================================================================
--- webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java (original)
+++ webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/HttpCoreNIOSender.java Tue May 29 04:37:28 2007
@@ -180,7 +180,7 @@
         HttpParams params = new BasicHttpParams();
         params
             .setIntParameter(HttpConnectionParams.SO_TIMEOUT,
-                cfg.getProperty(HttpConnectionParams.SO_TIMEOUT, 30000))
+                cfg.getProperty(HttpConnectionParams.SO_TIMEOUT, 60000))
             .setIntParameter(HttpConnectionParams.CONNECTION_TIMEOUT,
                 cfg.getProperty(HttpConnectionParams.CONNECTION_TIMEOUT, 10000))
             .setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE,

Modified: webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/NHttpConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/NHttpConfiguration.java?view=diff&rev=542493&r1=542492&r2=542493
==============================================================================
--- webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/NHttpConfiguration.java (original)
+++ webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/NHttpConfiguration.java Tue May 29 04:37:28 2007
@@ -38,6 +38,7 @@
     private static final int WORKER_KEEP_ALIVE     = 5;
     private static final int BLOCKING_QUEUE_LENGTH = -1;
     private static final int IO_WORKER_COUNT = 2;
+    private static final int BUFFER_SIZE           = 2048;
 
     // server listener
     private static final String S_T_CORE     = "snd_t_core";
@@ -53,6 +54,9 @@
     private static final String C_T_QLEN     = "lst_qlen";
     private static final String C_IO_WORKERS = "lst_io_threads";
 
+    // general
+    private static final String G_BUFFER_SIZE  = "nhttp_buffer_size";
+
     private static final Log log = LogFactory.getLog(NHttpConfiguration.class);
     private static NHttpConfiguration _instance = new NHttpConfiguration();
     private Properties props = new Properties();
@@ -106,6 +110,10 @@
 
     public int getClientIOWorkers() {
         return getProperty(C_IO_WORKERS, IO_WORKER_COUNT);
+    }
+
+    public int getBufferZise() {
+        return getProperty(G_BUFFER_SIZE, BUFFER_SIZE);
     }
 
     /**

Modified: webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/ServerHandler.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/ServerHandler.java?view=diff&rev=542493&r1=542492&r2=542493
==============================================================================
--- webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/ServerHandler.java (original)
+++ webservices/synapse/trunk/java/modules/nhttp/src/org/apache/axis2/transport/nhttp/ServerHandler.java Tue May 29 04:37:28 2007
@@ -64,6 +64,8 @@
 
     /** the Axis2 configuration context */
     ConfigurationContext cfgCtx = null;
+    /** the nhttp configuration */
+    private NHttpConfiguration cfg = null;
     /** is this https? */
     private boolean isHttps = false;
 
@@ -85,7 +87,7 @@
         this.httpProcessor = getHttpProcessor();
         this.connStrategy = new DefaultConnectionReuseStrategy();
 
-        NHttpConfiguration cfg = NHttpConfiguration.getInstance();
+        this.cfg = NHttpConfiguration.getInstance();
         this.workerPool = WorkerPoolFactory.getWorkerPool(
             cfg.getServerCoreThreads(),
             cfg.getServerMaxThreads(),
@@ -105,8 +107,8 @@
         context.setAttribute(HttpContext.HTTP_REQUEST, request);
 
         // allocate temporary buffers to process this request
-        context.setAttribute(REQUEST_BUFFER, ByteBuffer.allocate(2048));
-        context.setAttribute(RESPONSE_BUFFER, ByteBuffer.allocate(2048));
+        context.setAttribute(REQUEST_BUFFER, ByteBuffer.allocate(cfg.getBufferZise()));
+        context.setAttribute(RESPONSE_BUFFER, ByteBuffer.allocate(cfg.getBufferZise()));
 
         try {
             PipeImpl requestPipe  = new PipeImpl(); // the pipe used to process the request



---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org