Repository navigation
Conversation
milamberspace
left a comment
There was a problem hiding this comment.
Thanks for following up on #6461 so quickly! The approach matches what was discussed on the issue: the implementation and keep-alive are opt-in, and existing plans keep the Java implementation without keep-alive (the empty HTTPSampler.implementation default plus DEFAULT_NOT_SAVED take care of that). The delegation mirrors HTTPSamplerProxy nicely (sample(URL, ...), threadFinished, interrupt, testIterationStart), and the outdated code sample in the documentation is replaced with the actual LogParser.parseAndConfigure API.
Requested changes
- Unrelated commits: the four
#6591Xalan deprecation commits (PropertiesBasedPrefixResolver*,XPathUtil, the "Deprecate Xalan" entry and the contributor line inchanges.xml) belong to #6856. Please rebase this branch onmasterand keep only the #6461 commits, otherwise the two PRs will conflict or duplicate entries. - The test does not prove the delegation: the parameterized test only checks the
Connectionheader, which theJavaimplementation also sets according touseKeepAlive. Ifsample(URL, ...)never delegated, all six cases would still pass. Please add an implementation-specific assertion, e.g. on theUser-Agentheader sent by default (Java/...forJava,Apache-HttpClient/4...for HC4,Apache-HttpClient/5...for HC5), or check that the connection is actually reused. - changes.xml: the entry lacks
<pr>6859</pr>and does not mention the keep-alive option, which is the main motivation of the issue.
Minor
- Tests call
sampler.testEnded()but notthreadFinished(), so the HC4/HC5 clients created for the test thread are not closed. - An empty implementation means
Javahere, whereas for the HTTP Request sampler it means thejmeter.httpsamplerdefault (HttpClient4). That is the right choice for backward compatibility, but a sentence in the docs would avoid confusion. - In
AccessLogSampler:@SuppressWarnings("RedundantOverride")is on three of the four overrides but not ongetUseKeepAlive(), there is a double blank line before its Javadoc, and the Javadoc reads "Returns the keepAlive".
| * {@link PrefixResolver} implementation that loads prefix configuration from jmeter property xpath.namespace.config | ||
| * @deprecated This Xalan-based class is scheduled for removal. | ||
| */ | ||
| @Deprecated(since = "6.0", forRemoval = true) |
There was a problem hiding this comment.
This change (and those in PropertiesBasedPrefixResolverForXpath2, XPathUtil, plus the Xalan entry and contributor line in changes.xml) belongs to #6856, not to this PR. Could you rebase on master and drop the #6591 commits?
| assertTrue(sampler.sampleWithParser().isSuccessful) | ||
|
|
||
| server.wireMock.verifyThat( | ||
| getRequestedFor(urlEqualTo("/one")).withHeader("Connection", equalTo(expectedConnection)), |
There was a problem hiding this comment.
The Java implementation also sends Connection: keep-alive/close depending on useKeepAlive, so these assertions would pass even if the sampler never delegated to HC4/HC5. Please add something implementation-specific, for instance on the default User-Agent:
// expectedUserAgent: "Java/.*", "Apache-HttpClient/4.*" or "Apache-HttpClient/5.*"
server.wireMock.verifyThat(
getRequestedFor(urlEqualTo("/one")).withHeader("User-Agent", matching(expectedUserAgent)),
)| <li><issue>6250</issue>Avoid adding "; charset=" automatically to <code>multipart/form-data</code> requests to align behavior with modern HTTP clients.</li> | ||
| <li><issue>6080</issue>Preserve the original HTTP method when following 307 and 308 redirects according to the HTTP specification. Contributed by LeeJiWon (github.com/dlwldnjs1009)</li> | ||
| <li><issue>6267</issue><pr>6268</pr>Add a space between key and value after <code>:</code> in View Results Tree > Sampler result tab for better readability.</li> | ||
| <li><issue>6461</issue>Allow the Access Log Sampler to select the <code>Java</code>, <code>HttpClient4</code>, or <code>HttpClient5</code> implementation. The default remains <code>Java</code> with keep-alive disabled for backward compatibility.</li> |
There was a problem hiding this comment.
Please add <pr>6859</pr> and mention the new Use Keep-Alive option, e.g.:
| <li><issue>6461</issue>Allow the Access Log Sampler to select the <code>Java</code>, <code>HttpClient4</code>, or <code>HttpClient5</code> implementation. The default remains <code>Java</code> with keep-alive disabled for backward compatibility.</li> | |
| <li><issue>6461</issue><pr>6859</pr>Allow the Access Log Sampler to select the <code>Java</code>, <code>HttpClient4</code>, or <code>HttpClient5</code> implementation and to use keep-alive connections. The defaults remain <code>Java</code> with keep-alive disabled for backward compatibility.</li> |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
6fc4d96 to
2dc7c07
Compare
Description
Adds an Implementation selection (Java, HttpClient4, HttpClient5) and opt-in keep-alive to the Access Log Sampler, retaining Java/no-keep-alive defaults for existing plans.
Motivation and Context
Addresses #6461 by enabling per-thread connection management through HttpClient4/5 while preserving existing Access Log Sampler behavior unless users opt in.
How Has This Been Tested?
.�[gradlew.bat --quiet :src:protocol:http:test --tests org.apache.jmeter.protocol.http.sampler.AccessLogSamplerTest- passed (8 tests)..�[gradlew.bat --quiet classes style- passed.Screenshots (if appropriate):
Types of changes
Checklist: