You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/01/28 12:54:28 UTC

svn commit: r1780677 - in /axis/axis2/java/core/trunk/modules/transport: http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java

Author: veithen
Date: Sat Jan 28 12:54:28 2017
New Revision: 1780677

URL: http://svn.apache.org/viewvc?rev=1780677&view=rev
Log:
Remove the initializeTimeouts code. We set timeouts on a per request basis anyway and we should definitely not change settings of the connection manager (which is shared by all requests) based on information from the MessageContext, i.e. on a per request basis.

Modified:
    axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
    axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java

Modified: axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java?rev=1780677&r1=1780676&r2=1780677&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java Sat Jan 28 12:54:28 2017
@@ -44,50 +44,6 @@ public class HTTPSenderImpl extends HTTP
         return new RequestImpl(this, msgContext, methodName, url, requestEntity);
     }
 
-    /**
-     * This is used to get the dynamically set time out values from the message
-     * context. If the values are not available or invalid then the default
-     * values or the values set by the configuration will be used
-     * 
-     * @param msgContext
-     *            the active MessageContext
-     * @param httpClient
-     */
-    protected void initializeTimeouts(MessageContext msgContext, HttpClient httpClient) {
-        // If the SO_TIMEOUT of CONNECTION_TIMEOUT is set by dynamically the
-        // override the static config
-        Integer tempSoTimeoutProperty = (Integer) msgContext.getProperty(HTTPConstants.SO_TIMEOUT);
-        Integer tempConnTimeoutProperty = (Integer) msgContext
-                .getProperty(HTTPConstants.CONNECTION_TIMEOUT);
-        long timeout = msgContext.getOptions().getTimeOutInMilliSeconds();
-
-        if (tempConnTimeoutProperty != null) {
-            int connectionTimeout = tempConnTimeoutProperty.intValue();
-            // timeout for initial connection
-            httpClient.getHttpConnectionManager().getParams()
-                    .setConnectionTimeout(connectionTimeout);
-        } else {
-            // set timeout in client
-            if (timeout > 0) {
-                httpClient.getHttpConnectionManager().getParams()
-                        .setConnectionTimeout((int) timeout);
-            }
-        }
-
-        if (tempSoTimeoutProperty != null) {
-            int soTimeout = tempSoTimeoutProperty.intValue();
-            // SO_TIMEOUT -- timeout for blocking reads
-            httpClient.getHttpConnectionManager().getParams().setSoTimeout(soTimeout);
-            httpClient.getParams().setSoTimeout(soTimeout);
-        } else {
-            // set timeout in client
-            if (timeout > 0) {
-                httpClient.getHttpConnectionManager().getParams().setSoTimeout((int) timeout);
-                httpClient.getParams().setSoTimeout((int) timeout);
-            }
-        }
-    }
-
     protected HttpClient getHttpClient(MessageContext msgContext) {
         ConfigurationContext configContext = msgContext.getConfigurationContext();
 
@@ -143,9 +99,6 @@ public class HTTPSenderImpl extends HTTP
             // starvation to 30sec
             httpClient.getParams().setConnectionManagerTimeout(30000);
 
-            // Get the timeout values set in the runtime
-            initializeTimeouts(msgContext, httpClient);
-
             return httpClient;
         }
     }

Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java?rev=1780677&r1=1780676&r2=1780677&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java Sat Jan 28 12:54:28 2017
@@ -55,47 +55,6 @@ public class HTTPSenderImpl extends HTTP
         return new RequestImpl(this, msgContext, methodName, url, requestEntity);
     }
 
-    /**
-     * This is used to get the dynamically set time out values from the message
-     * context. If the values are not available or invalid then the default
-     * values or the values set by the configuration will be used
-     *
-     * @param msgContext the active MessageContext
-     * @param httpClient
-     */
-    protected void initializeTimeouts(MessageContext msgContext, AbstractHttpClient httpClient) {
-        // If the SO_TIMEOUT of CONNECTION_TIMEOUT is set by dynamically the
-        // override the static config
-        Integer tempSoTimeoutProperty = (Integer) msgContext.getProperty(HTTPConstants.SO_TIMEOUT);
-        Integer tempConnTimeoutProperty = (Integer) msgContext
-                .getProperty(HTTPConstants.CONNECTION_TIMEOUT);
-        long timeout = msgContext.getOptions().getTimeOutInMilliSeconds();
-
-        if (tempConnTimeoutProperty != null) {
-            int connectionTimeout = tempConnTimeoutProperty.intValue();
-            // timeout for initial connection
-            httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,
-                                                connectionTimeout);
-        } else {
-            // set timeout in client
-            if (timeout > 0) {
-                httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,
-                                                    (int) timeout);
-            }
-        }
-
-        if (tempSoTimeoutProperty != null) {
-            int soTimeout = tempSoTimeoutProperty.intValue();
-            // SO_TIMEOUT -- timeout for blocking reads
-            httpClient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, soTimeout);
-        } else {
-            // set timeout in client
-            if (timeout > 0) {
-                httpClient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, (int) timeout);
-            }
-        }
-    }
-
     protected AbstractHttpClient getHttpClient(MessageContext msgContext) {
         ConfigurationContext configContext = msgContext.getConfigurationContext();
 
@@ -162,9 +121,6 @@ public class HTTPSenderImpl extends HTTP
             //We don't need to set timeout for connection manager, since we are doing it below
             // and its enough
 
-            // Get the timeout values set in the runtime
-            initializeTimeouts(msgContext, httpClient);
-
             return httpClient;
         }
     }