org.springframework.util.ConcurrencyThrottleSupport Java Examples
The following examples show how to use
org.springframework.util.ConcurrencyThrottleSupport.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpleAsyncTaskExecutorTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void cannotExecuteWhenConcurrencyIsSwitchedOff() throws Exception { SimpleAsyncTaskExecutor executor = new SimpleAsyncTaskExecutor(); executor.setConcurrencyLimit(ConcurrencyThrottleSupport.NO_CONCURRENCY); assertTrue(executor.isThrottleActive()); assertThatIllegalStateException().isThrownBy(() -> executor.execute(new NoOpRunnable())); }
Example #2
Source File: SimpleAsyncTaskExecutorTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void cannotExecuteWhenConcurrencyIsSwitchedOff() throws Exception { SimpleAsyncTaskExecutor executor = new SimpleAsyncTaskExecutor(); executor.setConcurrencyLimit(ConcurrencyThrottleSupport.NO_CONCURRENCY); assertTrue(executor.isThrottleActive()); exception.expect(IllegalStateException.class); executor.execute(new NoOpRunnable()); }
Example #3
Source File: SimpleAsyncTaskExecutorTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@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()); }