Java Resilience4j RateLimitor似乎忽略了配置

Java Resilience4j RateLimitor似乎忽略了配置,java,multithreading,java-8,executorservice,resilience4j,Java,Multithreading,Java 8,Executorservice,Resilience4j,我对弹性4J比率限制器有问题 public static void main(final String[] args) throws InterruptedException { final ExternalService service = new ExternalService(); final ExecutorService executorService = Executors.newFixedThreadPool(30); final RateLimiterC

我对弹性4J比率限制器有问题

public static void main(final String[] args) throws InterruptedException {
    final ExternalService service = new ExternalService();
    final ExecutorService executorService = Executors.newFixedThreadPool(30);

    final RateLimiterConfig config = RateLimiterConfig.custom()
        .limitRefreshPeriod(Duration.ofSeconds(10))
        .limitForPeriod(3)
        .timeoutDuration(Duration.ofSeconds(12))
        .build();

    final RateLimiter rateLimiter = RateLimiter.of("RateLimiter", config);

    final Callable<Response<String>> callable = RateLimiter.decorateCallable(
        rateLimiter, () -> service.get(200, "OK")
    );

    executorService.submit(callable); //fine in first period
    executorService.submit(callable); //fine in first period
    executorService.submit(callable); //fine in first period
    executorService.submit(callable); //should wait 10 sec and fine in second period
    executorService.submit(callable); //should wait 10 sec and fine in second period
    executorService.submit(callable); //should wait 10 sec and fine in second period
    executorService.submit(callable); //should exit with timeout after 12 seconds
    executorService.submit(callable); //should exit with timeout after 12 seconds
    executorService.submit(callable); //should exit with timeout after 12 seconds


    Thread.sleep(Duration.ofSeconds(40).toMillis());
    executorService.shutdown();
}

因此,第一个周期似乎很好,但在那之后,RateLimiter允许接下来的五个线程,而最后一个线程从未被调用。

不幸的是,这是一个错误,它是1.2.0版的一部分,在PR 672中引入的。PR增加了每次通话请求多个许可证的可能性。该错误现已修复。

我正在调查。我创建了一个问题来跟踪它@罗伯特温克勒你现在能提供一个答案吗?我看到这个问题已经解决了,不幸的是这是一个错误,它是在PR中引入的,PR是1.2.0版的一部分。PR增加了每次通话请求多个许可证的可能性。错误现在已经修复。请在这里添加一个答案,以便我可以关闭它:不幸的是,对于1.3.1版本,这仍然不起作用。对于前6个调用,它可以正常工作,但其余3个调用不会引发异常
> Task :Main.main()
[12:24:53.5] Return standard response
[12:24:53.5] Return standard response
[12:24:53.5] Return standard response
[12:25:03.5] Return standard response
[12:25:03.5] Return standard response
[12:25:03.5] Return standard response
[12:25:03.5] Return standard response
[12:25:03.5] Return standard response

BUILD SUCCESSFUL in 40s