hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sam Berlin" <sber...@limepeer.com>
Subject NPE with threading and SimpleConnectionManager
Date Sun, 21 Dec 2003 20:37:43 GMT
Hi Folks,

It seems that SimpleConnectionManager is unable to properly manage sessions over multiple
threads (in rc2, atleast).  Is it even supposed to? (I don't see anything in the docs that
mentions yay or nay.)  The problem is that SimpleConnectionManager.getConnection() calls close
on the existing connection if it is open and HttpConnection throws an IllegalStateException
in various places if the connection is not open.  Thus, for example, one thread can enter
write(byte[], int, int) and another can then call close() on it, leaving the first thread
to throw an IllegalStateException when it resumes.

I imagine that there is no real pressing desire to fix this, as SimpleConnectionManager should
be just that (simple).  Perhaps the documentation for SimpleConnectionManager should explicitly
state that it is not designed to be used across multiple threads?  Should we create a new
SimpleConnectionManager (or, not provide one in the constructor for HttpClient, leaving it
to create its own) for each client?  The only problem with this that multiple requests won't
reuse the same connection.

For the stracktrace, visit: http://bugs.limewire.com/dev/exceptions/3.7.1/java.lang.IllegalStateException/Mac%20OS/1.1.8/err51460.txt
.  (Note that the line numbers may be off because I've modified the source slightly to work
with 1.1.8, but the spirit of the bug still exists in the unmodified source.)


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

View raw message