Skip to content

Commit f2df10c

Browse files
committed
Polishing
1 parent 03f1fab commit f2df10c

File tree

6 files changed

+34
-31
lines changed

6 files changed

+34
-31
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -961,7 +961,7 @@ public void preInstantiateSingletons() throws BeansException {
961961
for (String beanName : beanNames) {
962962
Object singletonInstance = getSingleton(beanName);
963963
if (singletonInstance instanceof SmartInitializingSingleton) {
964-
StartupStep smartInitialize = this.getApplicationStartup().start("spring.beans.smart-initialize")
964+
StartupStep smartInitialize = getApplicationStartup().start("spring.beans.smart-initialize")
965965
.tag("beanName", beanName);
966966
SmartInitializingSingleton smartSingleton = (SmartInitializingSingleton) singletonInstance;
967967
if (System.getSecurityManager() != null) {

spring-context/src/main/java/org/springframework/context/support/DefaultLifecycleProcessor.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -64,9 +64,10 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
6464

6565

6666
/**
67-
* Specify the maximum time allotted in milliseconds for the shutdown of
68-
* any phase (group of SmartLifecycle beans with the same 'phase' value).
69-
* <p>The default value is 30 seconds.
67+
* Specify the maximum time allotted in milliseconds for the shutdown of any
68+
* phase (group of {@link SmartLifecycle} beans with the same 'phase' value).
69+
* <p>The default value is 30000 milliseconds (30 seconds).
70+
* @see SmartLifecycle#getPhase()
7071
*/
7172
public void setTimeoutPerShutdownPhase(long timeoutPerShutdownPhase) {
7273
this.timeoutPerShutdownPhase = timeoutPerShutdownPhase;

spring-context/src/main/java/org/springframework/scheduling/concurrent/ExecutorConfigurationSupport.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ public void setRejectedExecutionHandler(@Nullable RejectedExecutionHandler rejec
108108
/**
109109
* Set whether to wait for scheduled tasks to complete on shutdown,
110110
* not interrupting running tasks and executing all tasks in the queue.
111-
* <p>Default is "false", shutting down immediately through interrupting
112-
* ongoing tasks and clearing the queue. Switch this flag to "true" if you
113-
* prefer fully completed tasks at the expense of a longer shutdown phase.
111+
* <p>Default is {@code false}, shutting down immediately through interrupting
112+
* ongoing tasks and clearing the queue. Switch this flag to {@code true} if
113+
* you prefer fully completed tasks at the expense of a longer shutdown phase.
114114
* <p>Note that Spring's container shutdown continues while ongoing tasks
115115
* are being completed. If you want this executor to block and wait for the
116116
* termination of tasks before the rest of the container continues to shut
@@ -211,9 +211,13 @@ public void destroy() {
211211
}
212212

213213
/**
214-
* Perform a shutdown on the underlying ExecutorService.
214+
* Perform a full shutdown on the underlying ExecutorService,
215+
* according to the corresponding configuration settings.
216+
* @see #setWaitForTasksToCompleteOnShutdown
217+
* @see #setAwaitTerminationMillis
215218
* @see java.util.concurrent.ExecutorService#shutdown()
216219
* @see java.util.concurrent.ExecutorService#shutdownNow()
220+
* @see java.util.concurrent.ExecutorService#awaitTermination
217221
*/
218222
public void shutdown() {
219223
if (logger.isDebugEnabled()) {

spring-context/src/test/java/org/springframework/scheduling/annotation/EnableAsyncTests.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -95,19 +95,17 @@ public void proxyingOccursWithMockitoStub() {
9595
public void properExceptionForExistingProxyDependencyMismatch() {
9696
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
9797
ctx.register(AsyncConfig.class, AsyncBeanWithInterface.class, AsyncBeanUser.class);
98-
assertThatExceptionOfType(UnsatisfiedDependencyException.class).isThrownBy(
99-
ctx::refresh)
100-
.withCauseInstanceOf(BeanNotOfRequiredTypeException.class);
98+
assertThatExceptionOfType(UnsatisfiedDependencyException.class).isThrownBy(ctx::refresh)
99+
.withCauseInstanceOf(BeanNotOfRequiredTypeException.class);
101100
ctx.close();
102101
}
103102

104103
@Test
105104
public void properExceptionForResolvedProxyDependencyMismatch() {
106105
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
107106
ctx.register(AsyncConfig.class, AsyncBeanUser.class, AsyncBeanWithInterface.class);
108-
assertThatExceptionOfType(UnsatisfiedDependencyException.class).isThrownBy(
109-
ctx::refresh)
110-
.withCauseInstanceOf(BeanNotOfRequiredTypeException.class);
107+
assertThatExceptionOfType(UnsatisfiedDependencyException.class).isThrownBy(ctx::refresh)
108+
.withCauseInstanceOf(BeanNotOfRequiredTypeException.class);
111109
ctx.close();
112110
}
113111

@@ -182,8 +180,7 @@ public void aspectModeAspectJAttemptsToRegisterAsyncAspect() {
182180
@SuppressWarnings("resource")
183181
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
184182
ctx.register(AspectJAsyncAnnotationConfig.class);
185-
assertThatExceptionOfType(BeanDefinitionStoreException.class).isThrownBy(
186-
ctx::refresh);
183+
assertThatExceptionOfType(BeanDefinitionStoreException.class).isThrownBy(ctx::refresh);
187184
}
188185

189186
@Test

spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -61,7 +61,7 @@ public void tearDown() {
6161
@EnabledForTestGroups(LONG_RUNNING)
6262
public void withFixedRateTask() throws InterruptedException {
6363
ctx = new AnnotationConfigApplicationContext(FixedRateTaskConfig.class);
64-
assertThat(ctx.getBean(ScheduledTaskHolder.class).getScheduledTasks().size()).isEqualTo(2);
64+
assertThat(ctx.getBean(ScheduledTaskHolder.class).getScheduledTasks()).hasSize(2);
6565

6666
Thread.sleep(100);
6767
assertThat(ctx.getBean(AtomicInteger.class).get()).isGreaterThanOrEqualTo(10);
@@ -71,7 +71,7 @@ public void withFixedRateTask() throws InterruptedException {
7171
@EnabledForTestGroups(LONG_RUNNING)
7272
public void withSubclass() throws InterruptedException {
7373
ctx = new AnnotationConfigApplicationContext(FixedRateTaskConfigSubclass.class);
74-
assertThat(ctx.getBean(ScheduledTaskHolder.class).getScheduledTasks().size()).isEqualTo(2);
74+
assertThat(ctx.getBean(ScheduledTaskHolder.class).getScheduledTasks()).hasSize(2);
7575

7676
Thread.sleep(100);
7777
assertThat(ctx.getBean(AtomicInteger.class).get()).isGreaterThanOrEqualTo(10);
@@ -81,13 +81,13 @@ public void withSubclass() throws InterruptedException {
8181
@EnabledForTestGroups(LONG_RUNNING)
8282
public void withExplicitScheduler() throws InterruptedException {
8383
ctx = new AnnotationConfigApplicationContext(ExplicitSchedulerConfig.class);
84-
assertThat(ctx.getBean(ScheduledTaskHolder.class).getScheduledTasks().size()).isEqualTo(1);
84+
assertThat(ctx.getBean(ScheduledTaskHolder.class).getScheduledTasks()).hasSize(1);
8585

8686
Thread.sleep(100);
8787
assertThat(ctx.getBean(AtomicInteger.class).get()).isGreaterThanOrEqualTo(10);
8888
assertThat(ctx.getBean(ExplicitSchedulerConfig.class).threadName).startsWith("explicitScheduler-");
8989
assertThat(Arrays.asList(ctx.getDefaultListableBeanFactory().getDependentBeans("myTaskScheduler")).contains(
90-
TaskManagementConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME)).isTrue();
90+
TaskManagementConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME)).isTrue();
9191
}
9292

9393
@Test
@@ -100,7 +100,7 @@ public void withExplicitSchedulerAmbiguity_andSchedulingEnabled() {
100100
@EnabledForTestGroups(LONG_RUNNING)
101101
public void withExplicitScheduledTaskRegistrar() throws InterruptedException {
102102
ctx = new AnnotationConfigApplicationContext(ExplicitScheduledTaskRegistrarConfig.class);
103-
assertThat(ctx.getBean(ScheduledTaskHolder.class).getScheduledTasks().size()).isEqualTo(1);
103+
assertThat(ctx.getBean(ScheduledTaskHolder.class).getScheduledTasks()).hasSize(1);
104104

105105
Thread.sleep(100);
106106
assertThat(ctx.getBean(AtomicInteger.class).get()).isGreaterThanOrEqualTo(10);

spring-jms/src/main/java/org/springframework/jms/listener/AbstractJmsListeningContainer.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,18 +125,19 @@ public boolean isAutoStartup() {
125125
}
126126

127127
/**
128-
* Specify the phase in which this container should be started and
129-
* stopped. The startup order proceeds from lowest to highest, and
130-
* the shutdown order is the reverse of that. By default this value
131-
* is Integer.MAX_VALUE meaning that this container starts as late
132-
* as possible and stops as soon as possible.
128+
* Specify the lifecycle phase in which this container should be started and stopped.
129+
* <p>The startup order proceeds from lowest to highest, and the shutdown order
130+
* is the reverse of that. The default is {@link #DEFAULT_PHASE} meaning that
131+
* this container starts as late as possible and stops as soon as possible.
132+
* @see SmartLifecycle#getPhase()
133133
*/
134134
public void setPhase(int phase) {
135135
this.phase = phase;
136136
}
137137

138138
/**
139-
* Return the phase in which this container will be started and stopped.
139+
* Return the lifecycle phase in which this container will be started and stopped.
140+
* @see #setPhase
140141
*/
141142
@Override
142143
public int getPhase() {

0 commit comments

Comments
 (0)