Return-Path: X-Original-To: apmail-hc-httpclient-users-archive@www.apache.org Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 66AE718497 for ; Wed, 29 Jul 2015 10:30:04 +0000 (UTC) Received: (qmail 70157 invoked by uid 500); 29 Jul 2015 10:29:57 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 70106 invoked by uid 500); 29 Jul 2015 10:29:57 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 70085 invoked by uid 99); 29 Jul 2015 10:29:57 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Jul 2015 10:29:57 +0000 Received: from ok2c (84.76.106.92.dynamic.wline.res.cust.swisscom.ch [92.106.76.84]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 01D681A0094 for ; Wed, 29 Jul 2015 10:29:56 +0000 (UTC) Message-ID: <1438165696.5203.3.camel@apache.org> Subject: Re: How to close the underlying connection within callback? From: Oleg Kalnichevski To: HttpClient User Discussion Date: Wed, 29 Jul 2015 12:28:16 +0200 In-Reply-To: References: <1438089503.22518.1.camel@apache.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit On Tue, 2015-07-28 at 19:06 +0530, Shushant Arora wrote: > Does this problem comes in PoolingNHttpClientConnectionManager also or > pooling manager handles this automatically without user being rethrow the > exception from failed callback method of > FutureCallback . > > And is it safe to retry the request from failed callback . > some sort of > > future = httpclient.execute(request1,new > AsyncHttpCallbackHandler(closeableHttpAsyncClient,request, currentRetry, > maxRetry)); > > class AsyncHttpCallbackHandler implements FutureCallback{ > > public void failed(Exception ex) { > //retry check and retry the request > closeableHttpAsyncClient.execute(request,this); > } > } > It might be safe but would rather avoid doing that. I would probably use a queue for all outgoing request and would re-introduce failed request back to the queue for re-execution. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org