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:01:45 UTC
svn commit: r885900 - in /httpcomponents/httpclient/trunk: ./
httpclient/src/main/java/org/apache/http/impl/client/
Author: olegk
Date: Tue Dec 1 20:01:44 2009
New Revision: 885900
URL: http://svn.apache.org/viewvc?rev=885900&view=rev
Log:
HTTPCLIENT-895: Log object lookups by short lived components impair performance
Modified:
httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/ClientParamsStack.java
httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
Modified: httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt?rev=885900&r1=885899&r2=885900&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient/trunk/RELEASE_NOTES.txt Tue Dec 1 20:01:44 2009
@@ -14,7 +14,10 @@
* Support for transparent content encoding. Please note transparent content
encoding is not enabled per default in order to avoid conflicts with
already existing custom content encoding solutions.
-
+
+* 5 to 10% performance increase due to elimination of unnecessary Log object
+ lookups by short-lived components.
+
Please note all methods and classes added in this release and marked as
4.1 are API unstable and can change in the future 4.1 ALPHA releases.
@@ -69,9 +72,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 lookups in short lived objects 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/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java?rev=885900&r1=885899&r2=885900&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java Tue Dec 1 20:01:44 2009
@@ -738,6 +738,7 @@
final UserTokenHandler stateHandler,
final HttpParams params) {
return new DefaultRequestDirector(
+ log,
requestExec,
conman,
reustrat,
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/ClientParamsStack.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/ClientParamsStack.java?rev=885900&r1=885899&r2=885900&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/ClientParamsStack.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/ClientParamsStack.java Tue Dec 1 20:01:44 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/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java?rev=885900&r1=885899&r2=885900&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java Tue Dec 1 20:01:44 2009
@@ -135,7 +135,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;
@@ -204,7 +204,8 @@
final AuthenticationHandler proxyAuthHandler,
final UserTokenHandler userTokenHandler,
final HttpParams params) {
- this(requestExec, conman, reustrat, kastrat, rouplan, httpProcessor, retryHandler,
+ this(LogFactory.getLog(DefaultRequestDirector.class),
+ requestExec, conman, reustrat, kastrat, rouplan, httpProcessor, retryHandler,
new DefaultRedirectStrategyAdaptor(redirectHandler),
targetAuthHandler, proxyAuthHandler, userTokenHandler, params);
}
@@ -214,6 +215,7 @@
* @since 4.1
*/
public DefaultRequestDirector(
+ final Log log,
final HttpRequestExecutor requestExec,
final ClientConnectionManager conman,
final ConnectionReuseStrategy reustrat,
@@ -227,6 +229,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.");
@@ -275,6 +281,7 @@
throw new IllegalArgumentException
("HTTP parameters may not be null");
}
+ this.log = log;
this.requestExec = requestExec;
this.connManager = conman;
this.reuseStrategy = reustrat;