Hi Greg, I just want to confirm, close() here is called on InputStream. By calling that it will close the underlying connection too? And it even true in case of HTTP/2?
Thanks a lot! Vào Th 4, 9 thg 10, 2019 lúc 05:28 Greg Wilkins <gr...@webtide.com> đã viết: > > Cao, > > The answer is "it depends". > > Closing the stream will result in the connection being closed and not > reused for other requests. Making new connections can be expensive, > especially if SSL is used, plus new connections are often slower than old > connections as their flow control windows are not well sized. > > So fully consuming some content so a connection may be reused may be > cheaper than closing... but if generating the data is expensive or there is > a lot of data yet to come, then perhaps not..... > > so your mileage may vary! > > > > > > > > On Wed, 9 Oct 2019 at 01:56, Đạt Cao Mạnh <caomanhdat...@gmail.com> wrote: > >> Hi guys, >> >> I kinda see this pattern frequently in Apache HttpClient >> >> Please note that if response content is not fully consumed the underlying >> connection cannot be safely re-used and will be shut down and discarded by >> the connection manager. >> >> >> Wondering it will be the same pattern need to apply when uses >> *InputStreamResponseListener*? Based on Javadoc >> >> If the consumer is faster than the producer, then the consumer will block >> with the typical InputStream.read() semantic. If the consumer is slower than >> the producer, then the producer will block until the client consumes >> >> So I kinda assume that close() without fully consume the *InputStream* will >> be better (since producer doesn't need to put more data into the stream). >> Is that true? >> >> Thanks! >> *------* >> *Cao Mạnh Đạt* >> *E-mail: caomanhdat...@gmail.com <caomanhdat...@gmail.com>* >> > _______________________________________________ >> jetty-users mailing list >> jetty-users@eclipse.org >> To change your delivery options, retrieve your password, or unsubscribe >> from this list, visit >> https://www.eclipse.org/mailman/listinfo/jetty-users > > > > -- > Greg Wilkins <gr...@webtide.com> CTO http://webtide.com > _______________________________________________ > jetty-users mailing list > jetty-users@eclipse.org > To change your delivery options, retrieve your password, or unsubscribe > from this list, visit > https://www.eclipse.org/mailman/listinfo/jetty-users -- *Best regards,* *Cao Mạnh Đạt* *E-mail: caomanhdat...@gmail.com <caomanhdat...@gmail.com>*
_______________________________________________ jetty-users mailing list jetty-users@eclipse.org To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users