On Wed, 2008-01-30 at 18:10 +0000, Christiaan Lamprecht wrote:
> Hi all,
> 
> The question is on how to permanently close a connection in the MTHCM
> connection pool.
> 
> I'm using the MultiThreadedHttpConnectionManager and each spawned
> thread makes a couple of "httpClient.executeMethod(method);" requests.
> 
> Now the connection pool never seems to grow beyond a certain point as
> each new thread re-uses one of the old connections, if available.
> 
> I assume this is because somewhere, apparently through
> method.releaseConnection(),  MTHCM.releaseConnection(HttpConnection
> conn) is called which "Make the given HttpConnection available for use
> by other requests. If another thread is blocked in getConnection()
> that could use this connection, it will be woken up"
> 
> I do also release the connection upon thread completion (Finally ->
> method.releaseConnection()) which states that "If the connection can
> be reused by other HTTP methods it is NOT closed at this point."  i.e
> the MTHCM decides.
> 
> Re-using a connection means re-using the SSL session associated with
> it. I need to create a new session for each client (i.e for each
> thread)
> 
> Potential solutions:
> * Somehow get the HttpConnection associated with the thread and
> explicitly close it. (Objects at my disposal: HttpClient, GetMethod
> and MTHCM)
> * Extend the MTHCM and overwrite the releaseConnection() method. (but
> might need access to some private variables and functions)

Christiaan,

If you just want to make sure that connections get closed upon release,
subclassing MTHCM and overriding releaseConnection() method should be
sufficient.

Oleg

> * Rewrite and compile the MTHCM sourcode. Possibly overwriting
> freeConnection (...) in the private class ConnectionPool.
> 
> I hope there's an easy solution!
> 
> 
> Many thanks again
> Christiaan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to