andreaslind01 commented on code in PR #6742:
URL: https://github.com/apache/jmeter/pull/6742#discussion_r4292939249
##########
src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java:
##########
@@ -514,15 +512,23 @@ public void process(HttpResponse response, HttpContext
context)
};
/**
- * 1 HttpClient instance per combination of (HttpClient,HttpClientKey)
+ * Clients of every JMeter thread, one per {@link HttpClientKey}, looked
up by the
+ * {@link JMeterContext} of that thread instead of by the thread itself.
The threads which
+ * download embedded resources in parallel are pooled and shared by all
JMeter threads, and they
+ * adopt the context of the JMeter thread they are working for, so looking
the clients up by
+ * context hands them the clients of that thread and keeps a JMeter thread
from closing or
+ * resetting clients another one is still using.
+ *
+ * <p>The keys are weak, so that a context whose clients are never closed
explicitly, like the
+ * one of a thread of the HTTP(S) Test Script Recorder, does not keep the
entry alive forever.
*/
- private static final ThreadLocal<Map<HttpClientKey, HttpClientState>>
- HTTPCLIENTS_CACHE_PER_THREAD_AND_HTTPCLIENTKEY = new
InheritableThreadLocal<>() {
- @Override
- protected Map<HttpClientKey, HttpClientState> initialValue() {
- return new HashMap<>(5);
- }
- };
+ private static final Map<JMeterContext, Map<HttpClientKey,
HttpClientState>>
+ HTTPCLIENTS_CACHE_PER_THREAD_AND_HTTPCLIENTKEY =
Collections.synchronizedMap(new WeakHashMap<>());
Review Comment:
This has been addressed and should be resolved by commit
[73e3f9c](https://github.com/apache/jmeter/pull/6742/commits/73e3f9c5dc448f128bb383c57836f57dc838e959).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]