Java 类org.springframework.util.ConcurrencyThrottleSupport 实例源码

项目:spring4-understanding    文件:SimpleAsyncTaskExecutorTests.java   
@Ignore("Disabled because task is still executed when concurrency is switched off")
@Test
public void cannotExecuteWhenConcurrencyIsSwitchedOff() throws Exception {
    SimpleAsyncTaskExecutor executor = new SimpleAsyncTaskExecutor();
    executor.setConcurrencyLimit(ConcurrencyThrottleSupport.NO_CONCURRENCY);
    assertFalse(executor.isThrottleActive());
    exception.expect(IllegalStateException.class);
    executor.execute(new NoOpRunnable());
}
项目:class-guard    文件:SimpleAsyncTaskExecutorTests.java   
public void testCannotExecuteWhenConcurrencyIsSwitchedOff() throws Exception {
    SimpleAsyncTaskExecutor executor = new SimpleAsyncTaskExecutor();
    executor.setConcurrencyLimit(ConcurrencyThrottleSupport.NO_CONCURRENCY);
    assertFalse(executor.isThrottleActive());
    try {
        executor.execute(new NoOpRunnable());
    }
    catch (IllegalStateException expected) {
    }
}