[EMAIL PROTECTED] wrote:

[snip]

/**
* Keep hitting a URL, with no sleep time.
*/
class ClientThread implements Runnable {
protected Thread m_thread;
protected boolean m_running = true;
public ClientThread( )
{
}
public void run( ) {
m_thread = Thread.currentThread( );
try {
while ( m_running )
{
PostMethod httppost = new PostMethod( m_serverURL.getPath( ) );
httppost.setRequestBody( "some random stuff that doesn't
matter" );
try {
// print out something so we know when there are active // threads
System.out.print( "." );
m_client.executeMethod( httppost );
} catch ( Throwable t )
{


// here you should add:
httppost.releaseConnection()

}
}
} catch ( Throwable t )
{
t.printStackTrace( System.out );
m_running = false;
}
}
}
}


If you don't call releaseConnection(), HttpClient doesn't know whether you're done reading the response to the request, so it doesn't free up the connection for re-use, and the MultiThreadedConnectionManager eventually appears to deadlock, while it is really waiting for you to call releaseConnection().

-Eric.


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



Reply via email to