Skip to content

Commit 8e8c3f5

Browse files
committed
Polishing
1 parent f50b230 commit 8e8c3f5

File tree

6 files changed

+25
-22
lines changed

6 files changed

+25
-22
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ public void preInstantiateSingletons() throws BeansException {
979979
for (String beanName : beanNames) {
980980
Object singletonInstance = getSingleton(beanName);
981981
if (singletonInstance instanceof SmartInitializingSingleton smartSingleton) {
982-
StartupStep smartInitialize = this.getApplicationStartup().start("spring.beans.smart-initialize")
982+
StartupStep smartInitialize = getApplicationStartup().start("spring.beans.smart-initialize")
983983
.tag("beanName", beanName);
984984
smartSingleton.afterSingletonsInstantiated();
985985
smartInitialize.end();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
6666
/**
6767
* Specify the maximum time allotted in milliseconds for the shutdown of
6868
* any phase (group of SmartLifecycle beans with the same 'phase' value).
69-
* <p>The default value is 30 seconds.
69+
* <p>The default value is 30000 milliseconds (30 seconds).
7070
*/
7171
public void setTimeoutPerShutdownPhase(long timeoutPerShutdownPhase) {
7272
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 & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,17 @@ public void proxyingOccursWithMockitoStub() {
9696
public void properExceptionForExistingProxyDependencyMismatch() {
9797
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
9898
ctx.register(AsyncConfig.class, AsyncBeanWithInterface.class, AsyncBeanUser.class);
99-
assertThatExceptionOfType(UnsatisfiedDependencyException.class).isThrownBy(
100-
ctx::refresh)
101-
.withCauseInstanceOf(BeanNotOfRequiredTypeException.class);
99+
assertThatExceptionOfType(UnsatisfiedDependencyException.class).isThrownBy(ctx::refresh)
100+
.withCauseInstanceOf(BeanNotOfRequiredTypeException.class);
102101
ctx.close();
103102
}
104103

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

@@ -208,8 +206,7 @@ public void aspectModeAspectJAttemptsToRegisterAsyncAspect() {
208206
@SuppressWarnings("resource")
209207
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
210208
ctx.register(AspectJAsyncAnnotationConfig.class);
211-
assertThatExceptionOfType(BeanDefinitionStoreException.class).isThrownBy(
212-
ctx::refresh);
209+
assertThatExceptionOfType(BeanDefinitionStoreException.class).isThrownBy(ctx::refresh);
213210
}
214211

215212
@Test
@@ -521,6 +518,7 @@ public Executor otherExecutor() {
521518
}
522519
}
523520

521+
524522
@Configuration
525523
@EnableAsync
526524
static class AsyncWithExecutorQualifiedByExpressionConfig {

spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.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.
@@ -89,7 +89,7 @@ public void withExplicitScheduler() throws InterruptedException {
8989
assertThat(ctx.getBean(AtomicInteger.class).get()).isGreaterThanOrEqualTo(10);
9090
assertThat(ctx.getBean(ExplicitSchedulerConfig.class).threadName).startsWith("explicitScheduler-");
9191
assertThat(Arrays.asList(ctx.getDefaultListableBeanFactory().getDependentBeans("myTaskScheduler")).contains(
92-
TaskManagementConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME)).isTrue();
92+
TaskManagementConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME)).isTrue();
9393
}
9494

9595
@Test

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)