Polishing
This commit is contained in:
@@ -28,8 +28,8 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||
|
||||
/**
|
||||
* Annotation that marks a method to be scheduled. Exactly one of the
|
||||
* {@link #cron}, {@link #fixedDelay}, or {@link #fixedRate} attributes must be
|
||||
* specified.
|
||||
* {@link #cron}, {@link #fixedDelay}, or {@link #fixedRate} attributes
|
||||
* must be specified.
|
||||
*
|
||||
* <p>The annotated method must expect no arguments. It will typically have
|
||||
* a {@code void} return type; if not, the returned value will be ignored
|
||||
@@ -40,6 +40,12 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||
* done manually or, more conveniently, through the {@code <task:annotation-driven/>}
|
||||
* XML element or {@link EnableScheduling @EnableScheduling} annotation.
|
||||
*
|
||||
* <p>This annotation can be used as a <em>{@linkplain Repeatable repeatable}</em>
|
||||
* annotation. If several scheduled declarations are found on the same method,
|
||||
* each of them will be processed independently, with a separate trigger firing
|
||||
* for each of them. As a consequence, such co-located schedules may overlap
|
||||
* and execute multiple times in parallel or in immediate succession.
|
||||
*
|
||||
* <p>This annotation may be used as a <em>meta-annotation</em> to create custom
|
||||
* <em>composed annotations</em> with attribute overrides.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -205,8 +205,7 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
* @param targetType the target type
|
||||
* @return the converted value
|
||||
* @throws ConversionException if a conversion exception occurred
|
||||
* @throws IllegalArgumentException if targetType is {@code null},
|
||||
* or sourceType is {@code null} but source is not {@code null}
|
||||
* @throws IllegalArgumentException if targetType is {@code null}
|
||||
*/
|
||||
@Nullable
|
||||
public Object convert(@Nullable Object source, TypeDescriptor targetType) {
|
||||
|
||||
@@ -445,9 +445,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
|
||||
logger.debug("Executing SQL query [" + sql + "]");
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to execute the query.
|
||||
*/
|
||||
// Callback to execute the query.
|
||||
class QueryStatementCallback implements StatementCallback<T>, SqlProvider {
|
||||
@Override
|
||||
@Nullable
|
||||
@@ -542,9 +540,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
|
||||
logger.debug("Executing SQL update [" + sql + "]");
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to execute the update statement.
|
||||
*/
|
||||
// Callback to execute the update statement.
|
||||
class UpdateStatementCallback implements StatementCallback<Integer>, SqlProvider {
|
||||
@Override
|
||||
public Integer doInStatement(Statement stmt) throws SQLException {
|
||||
@@ -570,9 +566,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
|
||||
logger.debug("Executing SQL batch update of " + sql.length + " statements");
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to execute the batch update.
|
||||
*/
|
||||
// Callback to execute the batch update.
|
||||
class BatchUpdateStatementCallback implements StatementCallback<int[]>, SqlProvider {
|
||||
|
||||
@Nullable
|
||||
@@ -1376,7 +1370,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!(param.isResultsParameter())) {
|
||||
if (!param.isResultsParameter()) {
|
||||
sqlColIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,6 +31,8 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.5.6
|
||||
* @see #doTranslate
|
||||
* @see #setFallbackTranslator
|
||||
*/
|
||||
public abstract class AbstractFallbackSQLExceptionTranslator implements SQLExceptionTranslator {
|
||||
|
||||
@@ -42,8 +44,8 @@ public abstract class AbstractFallbackSQLExceptionTranslator implements SQLExcep
|
||||
|
||||
|
||||
/**
|
||||
* Override the default SQL state fallback translator
|
||||
* (typically a {@link SQLStateSQLExceptionTranslator}).
|
||||
* Set the fallback translator to use when this translator cannot find a
|
||||
* specific match itself.
|
||||
*/
|
||||
public void setFallbackTranslator(@Nullable SQLExceptionTranslator fallback) {
|
||||
this.fallbackTranslator = fallback;
|
||||
@@ -51,6 +53,7 @@ public abstract class AbstractFallbackSQLExceptionTranslator implements SQLExcep
|
||||
|
||||
/**
|
||||
* Return the fallback exception translator, if any.
|
||||
* @see #setFallbackTranslator
|
||||
*/
|
||||
@Nullable
|
||||
public SQLExceptionTranslator getFallbackTranslator() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -75,8 +75,6 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
|
||||
private static final int MESSAGE_SQL_THROWABLE_CONSTRUCTOR = 4;
|
||||
private static final int MESSAGE_SQL_SQLEX_CONSTRUCTOR = 5;
|
||||
|
||||
|
||||
/** Error codes used by this translator. */
|
||||
@Nullable
|
||||
private SingletonSupplier<SQLErrorCodes> sqlErrorCodes;
|
||||
|
||||
@@ -194,9 +192,9 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
|
||||
if (sqlErrorCodes != null) {
|
||||
SQLExceptionTranslator customTranslator = sqlErrorCodes.getCustomSqlExceptionTranslator();
|
||||
if (customTranslator != null) {
|
||||
DataAccessException customDex = customTranslator.translate(task, sql, sqlEx);
|
||||
if (customDex != null) {
|
||||
return customDex;
|
||||
dae = customTranslator.translate(task, sql, sqlEx);
|
||||
if (dae != null) {
|
||||
return dae;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,11 +222,10 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
|
||||
for (CustomSQLErrorCodesTranslation customTranslation : customTranslations) {
|
||||
if (Arrays.binarySearch(customTranslation.getErrorCodes(), errorCode) >= 0 &&
|
||||
customTranslation.getExceptionClass() != null) {
|
||||
DataAccessException customException = createCustomException(
|
||||
task, sql, sqlEx, customTranslation.getExceptionClass());
|
||||
if (customException != null) {
|
||||
dae = createCustomException(task, sql, sqlEx, customTranslation.getExceptionClass());
|
||||
if (dae != null) {
|
||||
logTranslation(task, sql, sqlEx, true);
|
||||
return customException;
|
||||
return dae;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user