Return-Path: X-Original-To: apmail-hc-dev-archive@www.apache.org Delivered-To: apmail-hc-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A8AC0E218 for ; Tue, 19 Feb 2013 23:33:13 +0000 (UTC) Received: (qmail 48596 invoked by uid 500); 19 Feb 2013 23:33:13 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 48511 invoked by uid 500); 19 Feb 2013 23:33:13 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 48263 invoked by uid 99); 19 Feb 2013 23:33:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Feb 2013 23:33:13 +0000 Date: Tue, 19 Feb 2013 23:33:13 +0000 (UTC) From: "Martin Meinhold (JIRA)" To: dev@hc.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HTTPCLIENT-1310) Allow background validation to optionally back off after a number of failed requests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HTTPCLIENT-1310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13581753#comment-13581753 ] Martin Meinhold commented on HTTPCLIENT-1310: --------------------------------------------- Yeah, what you're suggesting crossed my mind as well. I could try to check if a response is stale or not by doing the calculation on my own. But why violate the DRY principle and force the client to know and handle all the corner case - the HttpClient could just expose a simple class which would be able to do so and return a boolean result. This could (no, it should) be used internally, too. The hint with the warning code is a very good one, didn't pay much attention to it, thank you. As you said, this looks pretty easy parsable. Will read the RFC regarding that. > Allow background validation to optionally back off after a number of failed requests > ------------------------------------------------------------------------------------ > > Key: HTTPCLIENT-1310 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1310 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: Cache > Reporter: Martin Meinhold > Attachments: 0001-HTTPCLIENT-1310-Allow-clients-to-change-the-used-sch.patch > > > We are successfully using the background validation to asynchronously update cache entries while returning a stale document (stale-while-revalidate cache control header). Also in case an error has happened, the stale document is used (stale-if-error cache control header). Works perfectly. Guys - great work you made this happen. > Now the tricky part: as soon there is an issue like e.g. the remote server is down, the stale-if-error header prevent the cache from being updated (which of course is the intention of that header). But this also means, that code using the HttpClient has no way to discover that there was an issue. So every following request will get that stale document but also trigger a background revalidation. > As an improvement it should be possible that the background validation backs off after a certain amount of failed requests. This should be optional and not the default. > I want to contribute some code we already have working on a 4.2 branch. The central idea is to vary the scheduling strategy the AsynchronousValidation uses to estimate _when_ the background validation of a certain request should happen. Of course, the default would be immediately. > In fact this would move code currently submitting tasks to the executor from the AsynchronousValidation into a separate class. Thus the AsynchronousValidation would become kind of a director role by simply enqueuing next requests and keeping track which of them failed and which were successful. A strategy could - based on the failure count - execute them immediately or later. Again, to clarify: the default behaviour would be to execute every incoming background validation request immediately regardless of the error count. > What do you think? -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org