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 Tue, 12 Aug 2014 23:34:31 GMT
Github user mfranklin commented on a diff in the pull request:

    https://github.com/apache/incubator-streams/pull/66#discussion_r16150098
  
    --- Diff: streams-util/src/main/java/org/apache/streams/util/api/requests/backoff/BackOffStrategy.java
---
    @@ -0,0 +1,87 @@
    +package org.apache.streams.util.api.requests.backoff;
    +
    +/**
    + * BackOffStrategy will cause the current thread to sleep for a specific amount of time.
This is used to adhere to
    + * api rate limits.
    + *
    + * The example below illustrates using a BackOffStrategy to slow down requests when you
hit a rate limit exception.
    + *
    + * <code>
    + *     public void pollApi(ApiClient apiClient, BackOffStrategy backOffStrategy) throws
BackOffException {
    + *          while( apiClient.hasMoreData() ) {
    + *              try {
    + *                  apiClient.pollData();
    + *              } catch (RateLimitException rle) {
    + *                  backOffStrategy.backOff();
    + *              }
    + *          }
    + *     }
    + * </code>
    + *
    + */
    +public abstract class BackOffStrategy {
    --- End diff --
    
    I think BackOffStrategy should be an interface.  This could become AbstractBackOffStrategy


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