Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller committed Jul 14, 2023
1 parent 6033773 commit 355fa25
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

/**
* 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
Expand All @@ -40,6 +40,12 @@
* 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.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -205,8 +205,7 @@ public Object convert(@Nullable Object source, @Nullable TypeDescriptor sourceTy
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,7 @@ public <T> T query(final String sql, final ResultSetExtractor<T> rse) throws Dat
logger.debug("Executing SQL query [" + sql + "]");
}

/**
* Callback to execute the query.
*/
// Callback to execute the query.
class QueryStatementCallback implements StatementCallback<T>, SqlProvider {
@Override
@Nullable
Expand Down Expand Up @@ -542,9 +540,7 @@ public int update(final String sql) throws DataAccessException {
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 {
Expand All @@ -570,9 +566,7 @@ public int[] batchUpdate(final String... sql) throws DataAccessException {
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
Expand Down Expand Up @@ -1376,7 +1370,7 @@ protected Map<String, Object> extractOutputParameters(CallableStatement cs, List
}
}
}
if (!(param.isResultsParameter())) {
if (!param.isResultsParameter()) {
sqlColIndex++;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -31,6 +31,8 @@
*
* @author Juergen Hoeller
* @since 2.5.6
* @see #doTranslate
* @see #setFallbackTranslator
*/
public abstract class AbstractFallbackSQLExceptionTranslator implements SQLExceptionTranslator {

Expand All @@ -42,15 +44,16 @@ 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;
}

/**
* Return the fallback exception translator, if any.
* @see #setFallbackTranslator
*/
@Nullable
public SQLExceptionTranslator getFallbackTranslator() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -194,9 +192,9 @@ protected DataAccessException doTranslate(String task, @Nullable String sql, SQL
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;
}
}
}
Expand Down Expand Up @@ -224,11 +222,10 @@ protected DataAccessException doTranslate(String task, @Nullable String sql, SQL
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;
}
}
}
Expand Down

0 comments on commit 355fa25

Please sign in to comment.