You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2009/12/01 21:14:58 UTC
svn commit: r885903 - in /httpcomponents/httpclient/branches/4.0.x: ./
httpclient/src/main/java/org/apache/http/impl/client/
Author: olegk
Date: Tue Dec 1 20:14:57 2009
New Revision: 885903
URL: http://svn.apache.org/viewvc?rev=885903&view=rev
Log:
HTTPCLIENT-895: Log object lookups by short lived components impair performance
Modified:
httpcomponents/httpclient/branches/4.0.x/RELEASE_NOTES.txt
httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/client/ClientParamsStack.java
httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
Modified: httpcomponents/httpclient/branches/4.0.x/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.0.x/RELEASE_NOTES.txt?rev=885903&r1=885902&r2=885903&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.0.x/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient/branches/4.0.x/RELEASE_NOTES.txt Tue Dec 1 20:14:57 2009
@@ -5,9 +5,16 @@
the previous stable release. None of the fixed bugs is considered critical.
Most notably this release eliminates eliminates dependency on JCIP annotations.
+This release is also expected to improve performance by 5 to 10% due to
+elimination of unnecessary Log object lookups by short-lived components.
+
Changelog
-------------------
+* [HTTPCLIENT-895] Eliminated Log object lookups by short-lived components
+ impairing performance.
+ Contributed by Oleg Kalnichevski <olegk at apache.org>
+
* [HTTPCLIENT-885] URLEncodedUtils now correctly parses form-url-encoded
entities that specify a charset.
Contributed by Oleg Kalnichevski <olegk at apache.org>
Modified: httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java?rev=885903&r1=885902&r2=885903&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java (original)
+++ httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java Tue Dec 1 20:14:57 2009
@@ -658,6 +658,7 @@
final UserTokenHandler stateHandler,
final HttpParams params) {
return new DefaultRequestDirector(
+ log,
requestExec,
conman,
reustrat,
Modified: httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/client/ClientParamsStack.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/client/ClientParamsStack.java?rev=885903&r1=885902&r2=885903&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/client/ClientParamsStack.java (original)
+++ httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/client/ClientParamsStack.java Tue Dec 1 20:14:57 2009
@@ -29,8 +29,6 @@
import org.apache.http.annotation.NotThreadSafe;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.http.params.HttpParams;
import org.apache.http.params.AbstractHttpParams;
@@ -73,8 +71,6 @@
@NotThreadSafe
public class ClientParamsStack extends AbstractHttpParams {
- private final Log log = LogFactory.getLog(getClass());
-
/** The application parameter collection, or <code>null</code>. */
protected final HttpParams applicationParams;
@@ -211,10 +207,6 @@
if ((result == null) && (applicationParams != null)) {
result = applicationParams.getParameter(name);
}
- if (this.log.isDebugEnabled() && result != null) {
- this.log.debug("'" + name + "': " + result);
- }
-
return result;
}
Modified: httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java?rev=885903&r1=885902&r2=885903&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java (original)
+++ httpcomponents/httpclient/branches/4.0.x/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java Tue Dec 1 20:14:57 2009
@@ -133,7 +133,7 @@
@NotThreadSafe // e.g. managedConn
public class DefaultRequestDirector implements RequestDirector {
- private final Log log = LogFactory.getLog(getClass());
+ private final Log log;
/** The connection manager. */
protected final ClientConnectionManager connManager;
@@ -184,7 +184,8 @@
private HttpHost virtualHost;
- public DefaultRequestDirector(
+ DefaultRequestDirector(
+ final Log log,
final HttpRequestExecutor requestExec,
final ClientConnectionManager conman,
final ConnectionReuseStrategy reustrat,
@@ -198,6 +199,10 @@
final UserTokenHandler userTokenHandler,
final HttpParams params) {
+ if (log == null) {
+ throw new IllegalArgumentException
+ ("Log may not be null.");
+ }
if (requestExec == null) {
throw new IllegalArgumentException
("Request executor may not be null.");
@@ -246,6 +251,7 @@
throw new IllegalArgumentException
("HTTP parameters may not be null");
}
+ this.log = log;
this.requestExec = requestExec;
this.connManager = conman;
this.reuseStrategy = reustrat;
@@ -267,6 +273,34 @@
this.proxyAuthState = new AuthState();
} // constructor
+ public DefaultRequestDirector(
+ final HttpRequestExecutor requestExec,
+ final ClientConnectionManager conman,
+ final ConnectionReuseStrategy reustrat,
+ final ConnectionKeepAliveStrategy kastrat,
+ final HttpRoutePlanner rouplan,
+ final HttpProcessor httpProcessor,
+ final HttpRequestRetryHandler retryHandler,
+ final RedirectHandler redirectHandler,
+ final AuthenticationHandler targetAuthHandler,
+ final AuthenticationHandler proxyAuthHandler,
+ final UserTokenHandler userTokenHandler,
+ final HttpParams params) {
+ this(LogFactory.getLog(DefaultRequestDirector.class),
+ requestExec,
+ conman,
+ reustrat,
+ kastrat,
+ rouplan,
+ httpProcessor,
+ retryHandler,
+ redirectHandler,
+ targetAuthHandler,
+ proxyAuthHandler,
+ userTokenHandler,
+ params);
+
+ }
private RequestWrapper wrapRequest(
final HttpRequest request) throws ProtocolException {