google / guava

Google core libraries for Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SmoothRateLimiter.SmoothBursty obtaining too many permits without failure

chenzhiguo opened this issue · comments

Description

I wrote a test case, but the test result did not meet expectations.

Example

@Test
    public void testTryAcquire_negative() {
        RateLimiter limiter = RateLimiter.create(5.0);
        Assertions.assertFalse(limiter.tryAcquire(5000, 0, SECONDS));
    }

Expected Behavior

Test success!

Actual Behavior

Test fail!

Packages

com.google.common.util.concurrent

Platforms

Java 8

Checklist

Okay, prefetching mode, first success, second failure