mirror of
https://github.com/apache/httpcomponents-client.git
synced 2025-02-16 23:16:33 +00:00
HTTPCLIENT-653: TSCCM is GCed after conn wrapper detach.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk@558802 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d035d4d209
commit
86dea0d47c
@ -1,5 +1,9 @@
|
||||
Changes since release 4.0 Alpha 1
|
||||
|
||||
* [HTTPCLIENT-653] detached connection wrapper no longer prevents
|
||||
garbage collection of ThreadSafeClientConnManager
|
||||
Contributed by Roland Weber <rolandw at apache.org>
|
||||
|
||||
* [HTTPCLIENT-674] use org.apache.http.util.VersionInfo instead of a local one
|
||||
Contributed by Roland Weber <rolandw at apache.org>
|
||||
|
||||
|
@ -348,21 +348,17 @@ public void testConnectionManagerGC() throws Exception {
|
||||
conn.markReusable();
|
||||
mgr.releaseConnection(conn);
|
||||
|
||||
// We now have a manager with an open connection. We drop all
|
||||
// potential hard reference to it and check whether it is GCed.
|
||||
// Note that the connection keeps a reference even if detached.
|
||||
// Internal references might prevent that if set up incorrectly.
|
||||
|
||||
// We now have a manager with an open connection in it's pool.
|
||||
// We drop all potential hard reference to the manager and check
|
||||
// whether it is GCed. Internal references might prevent that
|
||||
// if set up incorrectly.
|
||||
// Note that we still keep references to the connection wrapper
|
||||
// we got from the manager, directly as well as in the request
|
||||
// and in the context. The manager will be GCed only if the
|
||||
// connection wrapper is truly detached.
|
||||
WeakReference wref = new WeakReference(mgr);
|
||||
|
||||
request = null;
|
||||
response = null;
|
||||
mgr = null;
|
||||
|
||||
//@@@ the connection currently prevents the manager from being GCed
|
||||
conn = null;
|
||||
httpContext = null; // holds the connection and request
|
||||
|
||||
// Java does not guarantee that this will trigger the GC, but
|
||||
// it does in the test environment. GC is asynchronous, so we
|
||||
// need to give the garbage collector some time afterwards.
|
||||
|
Loading…
x
Reference in New Issue
Block a user