You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jakarta.apache.org by se...@apache.org on 2010/12/14 12:58:09 UTC
svn commit: r1049054 -
/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
Author: sebb
Date: Tue Dec 14 11:58:08 2010
New Revision: 1049054
URL: http://svn.apache.org/viewvc?rev=1049054&view=rev
Log:
Ensure temporary DefaultHttpClient is released.
Copy params to BasicHttpParams.
Modified:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1049054&r1=1049053&r2=1049054&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java (original)
+++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java Tue Dec 14 11:58:08 2010
@@ -92,14 +92,29 @@ public class HTTPHC4Impl extends HTTPHCA
// Scheme used for slow sockets. Cannot be set as a default, because must be set on an HttpClient instance.
private static final Scheme SLOW_HTTP;
private static final Scheme SLOW_HTTPS;
-
+
+ // get access to the copyParams method
+ // TODO replace with direct access once available
+ private static class CopyableParams extends BasicHttpParams{
+ private static final long serialVersionUID = 1L;
+ @Override
+ public void copyParams(HttpParams target) {
+ super.copyParams(target);
+ }
+ }
/*
* Create a set of default parameters from the ones initially created.
* This allows the defaults to be overridden if necessary from the properties file.
*/
- private static final HttpParams DEFAULT_HTTP_PARAMS = new DefaultHttpClient().getParams();
+ private static final HttpParams DEFAULT_HTTP_PARAMS = new CopyableParams();
static {
+
+ final DefaultHttpClient dhc = new DefaultHttpClient();
+ HttpParams dflt = dhc.getParams(); // Get the default params
+ ((CopyableParams) DEFAULT_HTTP_PARAMS).copyParams(dflt); // Convert to BasicHttpParams
+ dhc.getConnectionManager().shutdown(); // Tidy up
+
if (CPS_HTTP > 0) {
log.info("Setting up HTTP SlowProtocol, cps="+CPS_HTTP);
SLOW_HTTP = new Scheme(PROTOCOL_HTTP, DEFAULT_HTTP_PORT, new SlowHC4SocketFactory(CPS_HTTP));
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@jakarta.apache.org
For additional commands, e-mail: notifications-help@jakarta.apache.org