users@jersey.java.net

[Jersey] Re: Jersey 2.23 and connection closing

From: Thomas Meyer <thomas_at_m3y3r.de>
Date: Fri, 10 Jun 2016 17:26:57 +0200

Am 10. Juni 2016 15:58:15 MESZ, schrieb Rallavagu <rallavagu_at_gmail.com>:
>I have been using jersey 2.7 client version with HttpClient 4.3 for
>connection pooling.
>
>However, after upgrading to 2.23 (HttpClient to 4.5.2) I have noticed
>that connections are explicitly closed by jersey client instead of
>releasing them to connection pool. This is preventing connections from
>re-use.
>
>For instance, from 2.23 ApacheConnector.java
>
>private static InputStream getInputStream(final CloseableHttpResponse
>response) throws IOException {
>
> final InputStream inputStream;
>
> if (response.getEntity() == null) {
> inputStream = new ByteArrayInputStream(new byte[0]);
> } else {
> final InputStream i = response.getEntity().getContent();
> if (i.markSupported()) {
> inputStream = i;
> } else {
> inputStream = new BufferedInputStream(i,
>ReaderWriter.BUFFER_SIZE);
> }
> }
>
> return new FilterInputStream(inputStream) {
> @Override
> public void close() throws IOException {
> response.close();
> super.close();
> }
> };
> }
>
>The "response.close()" from above snippet explicitly closing
>"CloseableHttpClient" with "reuse" flag set to false.
>
>I understand that above behavior has been added due to following issue.
>
> https://java.net/jira/browse/JERSEY-2852
>
>However, this will present performance related issues. Is there a way
>that we can make connection closing via a property?
>
>Thanks

Oh, and nobody did ever touch my bug report :-(

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.