ConstantFlowRegulator implements ServiceWrapper { protected synchronized boolean canProceed() { if (requestPerSecondThreshold == -1) { return true; } if (lastRequestOccurance == 0) { lastRequestOccurance = System.currentTimeMillis(); return true; } if ((System.currentTimeMillis() - lastRequestOccurance) > deltaWaitTimeMillis) { lastRequestOccurance = System.currentTimeMillis(); return true; } return false; } ConstantFlowRegulator();  ConstantFlowRegulator(int requestsPerSecond);  ConstantFlowRegulator(int requestsPerSecond,
                                 ConstantFlowRegulatorExceptionMapper<? extends Exception> mapper); T invoke(Callable<T> c); void invoke(Runnable r); T invoke(Runnable r, T result); void setRequestPerSecondThreshold(int i); int getRequestPerSecondThreshold(); ConstantFlowRegulatorExceptionMapper<? extends Exception> getExceptionMapper(); void setExceptionMapper(ConstantFlowRegulatorExceptionMapper<? extends Exception> mapper);  }
@Test public void testFlowThrottlerCanProceedWhenThresholdIsDefault() { assertTrue(impl.canProceed()); }