Skip to content

Commit 0909161

Browse files
committed
Polishing
1 parent 4910c21 commit 0909161

File tree

6 files changed

+42
-31
lines changed

6 files changed

+42
-31
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 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.
@@ -45,7 +45,11 @@
4545
import org.springframework.util.Assert;
4646

4747
/**
48-
* Default implementation of the {@link LifecycleProcessor} strategy.
48+
* Spring's default implementation of the {@link LifecycleProcessor} strategy.
49+
*
50+
* <p>Provides interaction with {@link Lifecycle} and {@link SmartLifecycle} beans in
51+
* groups for specific phases, on startup/shutdown as well as for explicit start/stop
52+
* interactions on a {@link org.springframework.context.ConfigurableApplicationContext}.
4953
*
5054
* @author Mark Fisher
5155
* @author Juergen Hoeller
@@ -314,6 +318,8 @@ protected int getPhase(Lifecycle bean) {
314318
/**
315319
* Helper class for maintaining a group of Lifecycle beans that should be started
316320
* and stopped together based on their 'phase' value (or the default value of 0).
321+
* The group is expected to be created in an ad-hoc fashion and group members are
322+
* expected to always have the same 'phase' value.
317323
*/
318324
private class LifecycleGroup {
319325

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 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.
@@ -73,7 +73,7 @@ public abstract class ExecutorConfigurationSupport extends CustomizableThreadFac
7373

7474
/**
7575
* Set the ThreadFactory to use for the ExecutorService's thread pool.
76-
* Default is the underlying ExecutorService's default thread factory.
76+
* The default is the underlying ExecutorService's default thread factory.
7777
* <p>In a Jakarta EE or other managed environment with JSR-236 support,
7878
* consider specifying a JNDI-located ManagedThreadFactory: by default,
7979
* to be found at "java:comp/DefaultManagedThreadFactory".
@@ -108,7 +108,7 @@ 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 {@code false}, shutting down immediately through interrupting
111+
* <p>The default is {@code false}, shutting down immediately through interrupting
112112
* ongoing tasks and clearing the queue. Switch this flag to {@code true} if
113113
* 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
@@ -119,6 +119,8 @@ public void setRejectedExecutionHandler(@Nullable RejectedExecutionHandler rejec
119119
* property instead of or in addition to this property.
120120
* @see java.util.concurrent.ExecutorService#shutdown()
121121
* @see java.util.concurrent.ExecutorService#shutdownNow()
122+
* @see #shutdown()
123+
* @see #setAwaitTerminationSeconds
122124
*/
123125
public void setWaitForTasksToCompleteOnShutdown(boolean waitForJobsToCompleteOnShutdown) {
124126
this.waitForTasksToCompleteOnShutdown = waitForJobsToCompleteOnShutdown;
@@ -237,7 +239,7 @@ public void shutdown() {
237239
}
238240

239241
/**
240-
* Cancel the given remaining task which never commended execution,
242+
* Cancel the given remaining task which never commenced execution,
241243
* as returned from {@link ExecutorService#shutdownNow()}.
242244
* @param task the task to cancel (typically a {@link RunnableFuture})
243245
* @since 5.0.5

spring-context/src/test/java/org/springframework/scheduling/support/BitsCronFieldTests.java

Lines changed: 1 addition & 2 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-2024 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.
@@ -51,7 +51,6 @@ void parse() {
5151
assertThat(BitsCronField.parseMonth("1")).has(set(1)).has(clearRange(2, 12));
5252

5353
assertThat(BitsCronField.parseDaysOfWeek("0")).has(set(7, 7)).has(clearRange(0, 6));
54-
5554
assertThat(BitsCronField.parseDaysOfWeek("7-5")).has(clear(0)).has(setRange(1, 5))
5655
.has(clear(6)).has(set(7));
5756
}

spring-context/src/test/java/org/springframework/scheduling/support/QuartzCronFieldTests.java

Lines changed: 5 additions & 1 deletion
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-2024 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.
@@ -74,6 +74,7 @@ void lastDayOfWeekOffset() {
7474

7575
@Test
7676
void dayOfWeek_0(){
77+
// third Sunday (0) of the month
7778
QuartzCronField field = QuartzCronField.parseDaysOfWeek("0#3");
7879

7980
LocalDate last = LocalDate.of(2024, 1, 1);
@@ -83,6 +84,7 @@ void dayOfWeek_0(){
8384

8485
@Test
8586
void dayOfWeek_1(){
87+
// third Monday (1) of the month
8688
QuartzCronField field = QuartzCronField.parseDaysOfWeek("1#3");
8789

8890
LocalDate last = LocalDate.of(2024, 1, 1);
@@ -92,6 +94,7 @@ void dayOfWeek_1(){
9294

9395
@Test
9496
void dayOfWeek_2(){
97+
// third Tuesday (2) of the month
9598
QuartzCronField field = QuartzCronField.parseDaysOfWeek("2#3");
9699

97100
LocalDate last = LocalDate.of(2024, 1, 1);
@@ -101,6 +104,7 @@ void dayOfWeek_2(){
101104

102105
@Test
103106
void dayOfWeek_7() {
107+
// third Sunday (7 as alternative to 0) of the month
104108
QuartzCronField field = QuartzCronField.parseDaysOfWeek("7#3");
105109

106110
LocalDate last = LocalDate.of(2024, 1, 1);

spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2024 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.
@@ -158,7 +158,7 @@ public void initializeWithMetaData(DatabaseMetaData databaseMetaData) throws SQL
158158
}
159159
catch (SQLException ex) {
160160
if (logger.isWarnEnabled()) {
161-
logger.warn("Error retrieving 'DatabaseMetaData.getGeneratedKeys': " + ex.getMessage());
161+
logger.warn("Error retrieving 'DatabaseMetaData.supportsGetGeneratedKeys': " + ex.getMessage());
162162
}
163163
}
164164
try {
@@ -290,15 +290,15 @@ public String metaDataSchemaNameToUse(@Nullable String schemaName) {
290290
}
291291

292292
/**
293-
* Provide access to default schema for subclasses.
293+
* Provide access to the default schema for subclasses.
294294
*/
295295
@Nullable
296296
protected String getDefaultSchema() {
297297
return this.userName;
298298
}
299299

300300
/**
301-
* Provide access to version info for subclasses.
301+
* Provide access to the version info for subclasses.
302302
*/
303303
@Nullable
304304
protected String getDatabaseVersion() {

spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2024 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.
@@ -63,9 +63,6 @@ public class TableMetaDataContext {
6363
@Nullable
6464
private String schemaName;
6565

66-
// List of columns objects to be used in this context
67-
private List<String> tableColumns = new ArrayList<>();
68-
6966
// Should we access insert parameter meta-data info or not
7067
private boolean accessTableColumnMetaData = true;
7168

@@ -76,6 +73,9 @@ public class TableMetaDataContext {
7673
@Nullable
7774
private TableMetaDataProvider metaDataProvider;
7875

76+
// List of columns objects to be used in this context
77+
private List<String> tableColumns = new ArrayList<>();
78+
7979
// Are we using generated key columns
8080
private boolean generatedKeyColumnsUsed = false;
8181

@@ -139,7 +139,6 @@ public boolean isAccessTableColumnMetaData() {
139139
return this.accessTableColumnMetaData;
140140
}
141141

142-
143142
/**
144143
* Specify whether we should override default for accessing synonyms.
145144
*/
@@ -266,7 +265,6 @@ public List<Object> matchInParameterValuesWithInsertColumns(Map<String, ?> inPar
266265
return values;
267266
}
268267

269-
270268
/**
271269
* Build the insert string based on configuration and meta-data information.
272270
* @return the insert string to be used
@@ -303,8 +301,8 @@ public String createInsertString(String... generatedKeyNames) {
303301
}
304302
}
305303
else {
306-
String message = "Unable to locate columns for table '" + getTableName()
307-
+ "' so an insert statement can't be generated.";
304+
String message = "Unable to locate columns for table '" + getTableName() +
305+
"' so an insert statement can't be generated.";
308306
if (isAccessTableColumnMetaData()) {
309307
message += " Consider specifying explicit column names -- for example, via SimpleJdbcInsert#usingColumns().";
310308
}
@@ -349,35 +347,37 @@ public int[] createInsertTypes() {
349347

350348

351349
/**
352-
* Does this database support the JDBC 3.0 feature of retrieving generated keys:
353-
* {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()}?
350+
* Does this database support the JDBC feature for retrieving generated keys?
351+
* @see java.sql.DatabaseMetaData#supportsGetGeneratedKeys()
354352
*/
355353
public boolean isGetGeneratedKeysSupported() {
356354
return obtainMetaDataProvider().isGetGeneratedKeysSupported();
357355
}
358356

359357
/**
360-
* Does this database support simple query to retrieve generated keys
361-
* when the JDBC 3.0 feature is not supported:
362-
* {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()}?
358+
* Does this database support a simple query to retrieve generated keys when
359+
* the JDBC feature for retrieving generated keys is not supported?
360+
* @see #isGetGeneratedKeysSupported()
361+
* @see #getSimpleQueryForGetGeneratedKey(String, String)
363362
*/
364363
public boolean isGetGeneratedKeysSimulated() {
365364
return obtainMetaDataProvider().isGetGeneratedKeysSimulated();
366365
}
367366

368367
/**
369-
* Does this database support a simple query to retrieve generated keys
370-
* when the JDBC 3.0 feature is not supported:
371-
* {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()}?
368+
* Get the simple query to retrieve generated keys when the JDBC feature for
369+
* retrieving generated keys is not supported.
370+
* @see #isGetGeneratedKeysSimulated()
372371
*/
373372
@Nullable
374373
public String getSimpleQueryForGetGeneratedKey(String tableName, String keyColumnName) {
375374
return obtainMetaDataProvider().getSimpleQueryForGetGeneratedKey(tableName, keyColumnName);
376375
}
377376

378377
/**
379-
* Is a column name String array for retrieving generated keys supported:
380-
* {@link java.sql.Connection#createStruct(String, Object[])}?
378+
* Does this database support a column name String array for retrieving generated
379+
* keys?
380+
* @see java.sql.Connection#createStruct(String, Object[])
381381
*/
382382
public boolean isGeneratedKeysColumnNameArraySupported() {
383383
return obtainMetaDataProvider().isGeneratedKeysColumnNameArraySupported();

0 commit comments

Comments
 (0)