hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <http-as...@dubioso.net>
Subject Re: [HttpConn] manager
Date Sun, 21 Jan 2007 06:38:49 GMT
Good news,

some inspiring music on mind-shaking volume helped me
solve the riddle of the MTHCM, and with a good night's
sleep I'm ready to tackle the code. I even dimly remember
the discussions about the garbage collection thing.

The reason for the weak references is that an application
may allocate a connection and then just forget about it
without releasing it. Since the manager does not maintain
a hard reference to the connection, it will be GCed and
the vanishing weak reference tells the manager(s) that a
connection has been lost. Without the connection object,
it's hard to tell _which_ manager issued the connection
that was lost, hence there is a second map from the weak
references to the responsible managers.
I guess this strategy was introduced before the wrappers
that are being handed out nowadays. With the wrappers in
place, we can manage the connections in the traditional
way and instead keep a weak reference to the _wrapper_.
When the wrapper is GCed, the connection can be reclaimed.
That way, connections will never be cleaned up by the GC
(except when the whole connection manager is GCed) and
we don't have to rely on finalizers being called in order
to release for example native resources associated with
the connection.

Another missing puzzle piece is the route tracking that
is implemented in the old connection class by means of
a HostConfiguration and tunnelCreated flag. The new
interfaces have been defined bottom-up, so they don't
have this feature which is required by the manager. It's
not possible to map a managed connection to an operated
connection by a simple adapter without adding route
tracking. I'll need an extra class here, and that is the
place where I can fit the subclassing I mentioned earlier.

I'll get started right away...

cheers,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


Mime
View raw message