streams-dev mailing list archives

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

    https://github.com/apache/incubator-streams/pull/66#discussion_r16256756
  
    --- 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 --
    
    Ok


---
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