You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Eduardo Francos <ef...@incontext.fr> on 2003/03/02 12:09:54 UTC

[httpclient] Connection pooling

Hi,
I'm trying to use the MultiThreadedHttpConnectionManager but either I'm doing something wrong or there 
are bugs in the implementation that I couldn't pinpoint.
Difficult to say what is wrong because each time I run my tests I get different results.
When I don't use the pool by setting usingPool=false in the test program (see below) everything works 
fine.

I can either get different types of exceptions from different places in the library like:

java.lang.IllegalStateException: Connection is open
   at org.apache.commons.httpclient.HttpConnection.assertNotOpen(HttpConnection.java:1016)
   at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:494)
   at org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBase.java:2321)
   at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:937)
   at uitests.http.ConnectionPoolTest$MyRunnable.run(ConnectionPoolTest.java:217)
   at java.lang.Thread.run(Thread.java:536)

or 

java.lang.ArrayIndexOutOfBoundsException
   at java.net.SocketInputStream.socketRead0(Native Method)
   at java.net.SocketInputStream.read(SocketInputStream.java:129)
   at java.net.SocketInputStream.read(SocketInputStream.java:182)
   at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:900)
   at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1918)
   at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1678)
   at org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBase.java:2368)
   at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:937)
   at uitests.http.ConnectionPoolTest$MyRunnable.run(ConnectionPoolTest.java:220)
   at java.lang.Thread.run(Thread.java:536)
   
or

java.lang.NullPointerException
   at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:900)
   at org.apache.commons.httpclient.HttpMethodBase.readResponseHeaders(HttpMethodBase.java:1843)
   at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1680)
   at org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBase.java:2368)
   at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:937)
   at uitests.http.ConnectionPoolTest$MyRunnable.run(ConnectionPoolTest.java:218)
   at java.lang.Thread.run(Thread.java:536)
           
or it just gets stuck in a loop calling HttpConnection.readLine()

I set up a small (but too long to attach) test program at
http://www.incontext.fr/tempfiles/ConnectionPoolTest.java

I'd appreciate if someone could take a look at it and tell me what is it I'm doing wrong.

Thanks in advance
Eduardo




Re: [httpclient] Connection pooling

Posted by Eduardo Francos <ef...@incontext.fr>.
Anybody out there using MultiThreadedHttpConnectionManager successfully, or any other type of connection pooling?

Thanks
Eduardo