LeoWoerteler commented on code in PR #1380:
URL: https://github.com/apache/cxf/pull/1380#discussion_r1292354346
##########
rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpClientHTTPConduit.java:
##########
@@ -303,19 +303,34 @@ protected OutputStream createOutputStream(Message
message, boolean needToCacheRe
* This class <i>must</i> be static so it doesn't capture a reference to
{@code HttpClientHTTPConduit.this} and
* through that to {@link HttpClientHTTPConduit#client}. Otherwise the
client can never be garbage collected, which
* means that the companion "SelectorManager" thread keeps running
indefinitely (see CXF-8885).
+ * <p>
+ * The {@link HTTPClientPolicy} must be copied here because its property
change listeners can still have hard
+ * references to the {@code HttpClientHTTPConduit}.
*/
private static final class ProxyFactoryProxySelector extends ProxySelector
{
private final ProxyFactory proxyFactory;
- private final HTTPClientPolicy csPolicy;
+ private final HTTPClientPolicy clientPolicy;
ProxyFactoryProxySelector(ProxyFactory proxyFactory, HTTPClientPolicy
csPolicy) {
this.proxyFactory = proxyFactory;
- this.csPolicy = csPolicy;
+ this.clientPolicy = new HTTPClientPolicy();
Review Comment:
By the way, I'm also experimenting with registering the `HTTPConduit` as
listener via a `SoftReference<PropertyChangeListener>` to break the reference
chain, but that doesn't fix the problem in my experiments:
https://github.com/apache/cxf/commit/dd7131416971723868d95c7daf0153125937dfc4
It's really weird actually, the `HttpClientFacade`s are not being garbage
collected even though no GC roots are being found.
--
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]