Return-Path: X-Original-To: apmail-streams-dev-archive@minotaur.apache.org Delivered-To: apmail-streams-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B002811A11 for ; Tue, 12 Aug 2014 23:41:29 +0000 (UTC) Received: (qmail 23151 invoked by uid 500); 12 Aug 2014 23:41:29 -0000 Delivered-To: apmail-streams-dev-archive@streams.apache.org Received: (qmail 23110 invoked by uid 500); 12 Aug 2014 23:41:29 -0000 Mailing-List: contact dev-help@streams.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@streams.incubator.apache.org Delivered-To: mailing list dev@streams.incubator.apache.org Received: (qmail 23090 invoked by uid 99); 12 Aug 2014 23:41:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Aug 2014 23:41:29 +0000 X-ASF-Spam-Status: No, hits=-2000.7 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 12 Aug 2014 23:41:07 +0000 Received: (qmail 21832 invoked by uid 99); 12 Aug 2014 23:41:05 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Aug 2014 23:41:05 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id DED46990B67; Tue, 12 Aug 2014 23:41:04 +0000 (UTC) From: mfranklin To: dev@streams.incubator.apache.org Reply-To: dev@streams.incubator.apache.org References: In-Reply-To: Subject: [GitHub] incubator-streams pull request: Streams 143 Content-Type: text/plain Message-Id: <20140812234104.DED46990B67@tyr.zones.apache.org> Date: Tue, 12 Aug 2014 23:41:04 +0000 (UTC) X-Virus-Checked: Checked by ClamAV on apache.org Github user mfranklin commented on a diff in the pull request: https://github.com/apache/incubator-streams/pull/66#discussion_r16150363 --- Diff: streams-util/src/main/java/org/apache/streams/util/api/requests/backoff/impl/ExponentialBackOffStrategy.java --- @@ -0,0 +1,32 @@ +package org.apache.streams.util.api.requests.backoff.impl; + +import org.apache.streams.util.api.requests.backoff.BackOffStrategy; + +/** + * Exponential backk strategy. Caluclated by baseBackOffTimeInSeconds raised the attempt-count power. + */ +public class ExponentialBackOffStrategy extends BackOffStrategy { + + + /** + * Unlimited use ExponentialBackOffStrategy + * @param baseBackOffTimeInSeconds + */ + public ExponentialBackOffStrategy(int baseBackOffTimeInSeconds) { + this(baseBackOffTimeInSeconds, -1); + } + + /** + * Limited use ExponentialBackOffStrategy + * @param baseBackOffTimeInSeconds + * @param maxNumAttempts + */ + public ExponentialBackOffStrategy(int baseBackOffTimeInSeconds, int maxNumAttempts) { + super(baseBackOffTimeInSeconds, maxNumAttempts); + } + + @Override + protected long calculateBackOffTime(int attemptCount, long baseSleepTime) { + return Math.round(Math.pow(baseSleepTime, attemptCount)) * 1000; --- End diff -- Why multiply by 1000? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---