@Test public void testThrottling() throws InterruptedException { Assert.assertTrue(this.limiter.acquirePermits(1) != null); Thread.sleep(1000); Assert.assertTrue(this.limiter.acquirePermits(1) != null); Thread.sleep(1000); Assert.assertTrue(this.limiter.acquirePermits(1) != null); Thread.sleep(1100); Assert.assertTrue(this.limiter.acquirePermits(1) == null); }
@Override public Closeable acquirePermits(long permits) throws InterruptedException { return this.canIssuePermit ? NO_OP_CLOSEABLE : null; }
TimeBasedLimiter extends NonRefillableLimiter { @Override public Closeable acquirePermits(long permits) throws InterruptedException { return this.canIssuePermit ? NO_OP_CLOSEABLE : null; } }
TimeBasedLimiter extends NonRefillableLimiter { @Override public Closeable acquirePermits(long permits) throws InterruptedException { return this.canIssuePermit ? NO_OP_CLOSEABLE : null; } TimeBasedLimiter(long timeLimit);  TimeBasedLimiter(long timeLimit, TimeUnit timeUnit); }
TimeBasedLimiter extends NonRefillableLimiter { @Override public Closeable acquirePermits(long permits) throws InterruptedException { return this.canIssuePermit ? NO_OP_CLOSEABLE : null; } TimeBasedLimiter(long timeLimit);  TimeBasedLimiter(long timeLimit, TimeUnit timeUnit); @Override void start(); @Override Closeable acquirePermits(long permits); @Override void stop(); }
TimeBasedLimiter extends NonRefillableLimiter { @Override public Closeable acquirePermits(long permits) throws InterruptedException { return this.canIssuePermit ? NO_OP_CLOSEABLE : null; } TimeBasedLimiter(long timeLimit);  TimeBasedLimiter(long timeLimit, TimeUnit timeUnit); @Override void start(); @Override Closeable acquirePermits(long permits); @Override void stop();  }