streams-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rbnks <...@git.apache.org>
Subject [GitHub] incubator-streams pull request: Streams 143
Date Wed, 13 Aug 2014 20:33:29 GMT
Github user rbnks commented on a diff in the pull request:

    https://github.com/apache/incubator-streams/pull/66#discussion_r16203477
  
    --- 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 --
    
    Because the baseSleepTime is in seconds, so to get to milliseconds it needs to be multiplied
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.
---

Mime
View raw message