Skip to content

Commit b794abd

Browse files
committed
Polishing
1 parent 5cae769 commit b794abd

File tree

6 files changed

+20
-24
lines changed

6 files changed

+20
-24
lines changed

spring-aop/src/main/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*
3131
* <p>Can be applied to methods of local services that involve heavy use
3232
* of system resources, in a scenario where it is more efficient to
33-
* throttle concurrency for a specific service rather than restricting
33+
* throttle concurrency for a specific service rather than restrict
3434
* the entire thread pool (for example, the web container's thread pool).
3535
*
3636
* <p>The default concurrency limit of this interceptor is 1.
@@ -53,7 +53,7 @@ public ConcurrencyThrottleInterceptor() {
5353
}
5454

5555
/**
56-
* Create a default {@code ConcurrencyThrottleInterceptor}
56+
* Create a {@code ConcurrencyThrottleInterceptor}
5757
* with the given concurrency limit.
5858
* @since 7.0
5959
*/

spring-aop/src/test/java/org/springframework/aop/interceptor/ConcurrencyThrottleInterceptorTests.java

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import org.apache.commons.logging.Log;
2020
import org.apache.commons.logging.LogFactory;
2121
import org.junit.jupiter.api.Test;
22+
import org.junit.jupiter.params.ParameterizedTest;
23+
import org.junit.jupiter.params.provider.ValueSource;
2224

2325
import org.springframework.aop.framework.Advised;
2426
import org.springframework.aop.framework.ProxyFactory;
@@ -30,21 +32,23 @@
3032
import static org.assertj.core.api.Assertions.assertThat;
3133

3234
/**
35+
* Tests for {@link ConcurrencyThrottleInterceptor}.
36+
*
3337
* @author Juergen Hoeller
3438
* @author Chris Beams
3539
* @since 06.04.2004
3640
*/
3741
class ConcurrencyThrottleInterceptorTests {
3842

39-
protected static final Log logger = LogFactory.getLog(ConcurrencyThrottleInterceptorTests.class);
43+
private static final Log logger = LogFactory.getLog(ConcurrencyThrottleInterceptorTests.class);
4044

41-
public static final int NR_OF_THREADS = 100;
45+
private static final int NR_OF_THREADS = 100;
4246

43-
public static final int NR_OF_ITERATIONS = 1000;
47+
private static final int NR_OF_ITERATIONS = 1000;
4448

4549

4650
@Test
47-
void testSerializable() throws Exception {
51+
void interceptorMustBeSerializable() throws Exception {
4852
DerivedTestBean tb = new DerivedTestBean();
4953
ProxyFactory proxyFactory = new ProxyFactory();
5054
proxyFactory.setInterfaces(ITestBean.class);
@@ -62,17 +66,9 @@ void testSerializable() throws Exception {
6266
serializedProxy.getAge();
6367
}
6468

65-
@Test
66-
void testMultipleThreadsWithLimit1() {
67-
testMultipleThreads(1);
68-
}
69-
70-
@Test
71-
void testMultipleThreadsWithLimit10() {
72-
testMultipleThreads(10);
73-
}
74-
75-
private void testMultipleThreads(int concurrencyLimit) {
69+
@ParameterizedTest
70+
@ValueSource(ints = {1, 10})
71+
void multipleThreadsWithLimit(int concurrencyLimit) {
7672
TestBean tb = new TestBean();
7773
ProxyFactory proxyFactory = new ProxyFactory();
7874
proxyFactory.setInterfaces(ITestBean.class);

spring-context/src/main/java/org/springframework/resilience/annotation/ConcurrencyLimitBeanPostProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
/**
4040
* A convenient {@link org.springframework.beans.factory.config.BeanPostProcessor
4141
* BeanPostProcessor} that applies a concurrency interceptor to all bean methods
42-
* annotated with {@link ConcurrencyLimit} annotations.
42+
* annotated with {@link ConcurrencyLimit @ConcurrencyLimit}.
4343
*
4444
* @author Juergen Hoeller
4545
* @since 7.0

spring-context/src/main/java/org/springframework/resilience/annotation/EnableResilientMethods.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727

2828
/**
2929
* Enables Spring's core resilience features for method invocations:
30-
* {@link Retryable} as well as {@link ConcurrencyLimit}.
30+
* {@link Retryable @Retryable} as well as {@link ConcurrencyLimit @ConcurrencyLimit}.
3131
*
32-
* <p>These annotations can also be individually enabled through
33-
* defining a {@link RetryAnnotationBeanPostProcessor} and/or a
32+
* <p>These annotations can also be individually enabled by
33+
* defining a {@link RetryAnnotationBeanPostProcessor} or a
3434
* {@link ConcurrencyLimitBeanPostProcessor}.
3535
*
3636
* @author Juergen Hoeller
@@ -61,7 +61,7 @@
6161
* Indicate the order in which the {@link RetryAnnotationBeanPostProcessor}
6262
* and {@link ConcurrencyLimitBeanPostProcessor} should be applied.
6363
* <p>The default is {@link Ordered#LOWEST_PRECEDENCE} in order to run
64-
* after all other post-processors, so that it can add an advisor to
64+
* after all other post-processors, so that they can add advisors to
6565
* existing proxies rather than double-proxy.
6666
*/
6767
int order() default Ordered.LOWEST_PRECEDENCE;

spring-context/src/main/java/org/springframework/resilience/annotation/ResilientMethodsConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void setImportMetadata(AnnotationMetadata importMetadata) {
5353
private void configureProxySupport(ProxyProcessorSupport proxySupport) {
5454
if (this.enableResilientMethods != null) {
5555
proxySupport.setProxyTargetClass(this.enableResilientMethods.getBoolean("proxyTargetClass"));
56-
proxySupport.setOrder(this.enableResilientMethods.<Integer>getNumber("order"));
56+
proxySupport.setOrder(this.enableResilientMethods.getNumber("order"));
5757
}
5858
}
5959

spring-context/src/main/java/org/springframework/resilience/annotation/RetryAnnotationBeanPostProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
/**
4646
* A convenient {@link org.springframework.beans.factory.config.BeanPostProcessor
4747
* BeanPostProcessor} that applies a retry interceptor to all bean methods
48-
* annotated with {@link Retryable} annotations.
48+
* annotated with {@link Retryable @Retryable}.
4949
*
5050
* @author Juergen Hoeller
5151
* @since 7.0

0 commit comments

Comments
 (0)