All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.transferwise.tasks.helpers.ErrorLoggingThrottler Maven / Gradle / Ivy

There is a newer version: 1.43.0
Show newest version
package com.transferwise.tasks.helpers;

import com.google.common.util.concurrent.RateLimiter;
import org.springframework.beans.factory.InitializingBean;

public class ErrorLoggingThrottler implements IErrorLoggingThrottler, InitializingBean {

  private RateLimiter rateLimiter;

  @Override
  public void afterPropertiesSet() {
    rateLimiter = RateLimiter.create(0.2);
  }

  @Override
  public boolean canLogError() {
    return rateLimiter.tryAcquire(1);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy