I've been looking into this a little more and I'm actually not sure if AutoCloseInputStream should close the stream or not. I vaguely remember when this was first written and the various interactions are quite complex. In most cases the AutoCloseInputStream is not wrapping the actual socket stream. Usually there is another stream in the middle, either a ContentLengthInputStream or ChunkedInputStream. Both of which do not close the socket stream. The only case a socket input stream will be closed is when there is no chunking or content length. For this case it is difficult to determine when the response content is complete and therefore when it can be reused. In this case it might actually be reasonable to close the socket stream and force a reconnect. What does everyone think?2) From a connection standpoint, if the new url is to the same protocol://host:port then I would expect that the connection be reused for performance purposes. If not, then a new connection has to be established and the old one should probablly be closed. But the call to recycle() will release the connection so it won't be re-used. The point of calling recycle is for efficiency but if we are always releasing the connection, then all we are saving is object construction time which is tiny compared to the time to establish a connection.In this case the connection should be reused and I believe it is. It should work something like the following:
1) recycle() is called which then calls releaseConnection()
2) releaseConnection() closes the response stream which causes the any unread response to be read ( note this is not the actual socket input stream but an instance of AutoCloseInputStream )
3) the connection is closed if needed (if connection close was set)
4) the connection goes back to the connection manager
5) the next request to the connection manager should reuse the same connection if appropriate
Now that I've said all of this is, it appears that AutoCloseInputStream is not doing quite what it should. AutoCloseInputStream.notifyWatcher() calls super.close() which will close the socket InputStream. This is not what we want. Once this is changed this problem should go away.
Mike
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]