hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Deprecation of HttpEntity#consumeContent()
Date Thu, 03 Apr 2008 18:12:12 GMT

On Thu, 2008-04-03 at 13:00 -0400, Sam Berlin wrote:
> > * As far as streaming entities are concerned #consumeContent is
> > equivalent to a trivial code snippet
> >
> > InputStream instream = entity.getContent();
> > if (instream != null) instream.close();
> 
> Is that all consumeContent does?  I was under the impression that it
> gobbled up the rest of the data (assuming there was unread data), and
> left the connection in a state that it can be reused by subsequent
> requests. 

Sam,

The initial intent of this method was indeed to ensure the connection
can be reused, but it just does not work with NIO entities introduced
recently. Besides, for all existing blocking entities the implementation
of this method merely closes the input stream and that is it.     

>  If all it does is close the inputstream (and by extension,
> close the connection), then I'm +1 on the change.  If it instead read
> the data & left the connection usable, I'm -1 on it.
> 

But this is the responsibility of the underlying input stream #close()
anyways. This is precisely the reason I do not see a lot of value in
#consumeContent(). I also do not like the fact its name conflicts with
that of the ConsumingNHttpEntity#consumeContent().

Oleg


> Sam
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
> 


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


Mime
View raw message