Hello, I hope this is the last question ... On our proxy we are reading the response from the backend with a FutureCallback<HttpResponse>. On the complete method, we process the response body in this way:
public void completed(HttpResponse objResponse) { HttpEntity entity = null; try { entity = objResponse.getEntity(); int contentLength = (int)entity.getContentLength(); ByteArrayOutputStream baos = new ByteArrayOutputStream(contentLength > 0 ? contentLength : this.bufferHttpRespuestas); Bis = new BufferedInputStream(entity.getContent(), this.bufferHttpRespuestas); byte[] tmp = new byte[this.bufferHttpRespuestas]; int numBytesRead; while ((numBytesRead = bis.read(tmp)) >= 0) baos.write(tmp, 0, numBytesRead); ( . . .) The response is read from the inputstream contained in 'objHttpResponse', this response is already read so no network calls here (we read locally from the ' objResponse' object). Reading the body in this way, am I storing this body twice, one in the ' objResponse' and another in the 'baos' variable? In the link to the benchmark you sent me, a HttpAsyncResponseConsumer is used, so the content is processed in chunks on the consumeContent method (and I understand that the 'responseReceived' method is called once the headers have been processed). So the point is: is one of these methods better taking into account that my responses can be really large and I always need to store them in memory for further processing? Thanks, Joan. -----Mensaje original----- De: Oleg Kalnichevski [mailto:ol...@apache.org] Enviado el: jueves, 17 de marzo de 2016 10:50 Para: HttpClient User Discussion Asunto: Re: Help with async client On Thu, 2016-03-17 at 10:42 +0100, Joan Balagueró wrote: > Hi Oleg, > > Thanks. If I have a 400ms connection timeout and a 850ms response timeout, I > understand that the select interval must contain the 400ms (the lowest > value). True? > Yes. > In our app these connection/response timeouts can be modified on the fly. > That's why we are using a request config, and for each request we perform a > copy of the default request config and replace the values for > connect/response timeout. > > So, the select interval should also be modified in this case. Is this > possible with the 'PoolingNHttpClientConnectionManager' already created? No. > Because I don't see any method to get the IOReactor config from the nio pool. > Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org