Skip to content

Commit 4071139

Browse files
committed
Polishing
1 parent 4cf5c77 commit 4071139

File tree

4 files changed

+32
-36
lines changed

4 files changed

+32
-36
lines changed

spring-context/src/main/java/org/springframework/context/annotation/Configuration.java

Lines changed: 3 additions & 3 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.
@@ -104,8 +104,8 @@
104104
*
105105
* }</pre>
106106
*
107-
* <p>{@code @Configuration} classes may not only be bootstrapped using
108-
* component scanning, but may also themselves <em>configure</em> component scanning using
107+
* <p>{@code @Configuration} classes may not only be bootstrapped using component
108+
* scanning, but may also themselves <em>configure</em> component scanning using
109109
* the {@link ComponentScan @ComponentScan} annotation:
110110
*
111111
* <pre class="code">

spring-core/src/main/java/org/springframework/util/backoff/ExponentialBackOff.java

Lines changed: 14 additions & 17 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.
@@ -20,12 +20,12 @@
2020

2121
/**
2222
* Implementation of {@link BackOff} that increases the back off period for each
23-
* retry attempt. When the interval has reached the {@link #setMaxInterval(long)
23+
* retry attempt. When the interval has reached the {@linkplain #setMaxInterval
2424
* max interval}, it is no longer increased. Stops retrying once the
25-
* {@link #setMaxElapsedTime(long) max elapsed time} has been reached.
25+
* {@linkplain #setMaxElapsedTime max elapsed time} has been reached.
2626
*
27-
* <p>Example: The default interval is {@value #DEFAULT_INITIAL_INTERVAL} ms,
28-
* the default multiplier is {@value #DEFAULT_MULTIPLIER}, and the default max
27+
* <p>Example: The default interval is {@value #DEFAULT_INITIAL_INTERVAL} ms;
28+
* the default multiplier is {@value #DEFAULT_MULTIPLIER}; and the default max
2929
* interval is {@value #DEFAULT_MAX_INTERVAL}. For 10 attempts the sequence will be
3030
* as follows:
3131
*
@@ -44,10 +44,9 @@
4444
* 10 30000
4545
* </pre>
4646
*
47-
* <p>Note that the default max elapsed time is {@link Long#MAX_VALUE}. Use
48-
* {@link #setMaxElapsedTime(long)} to limit the maximum length of time
49-
* that an instance should accumulate before returning
50-
* {@link BackOffExecution#STOP}.
47+
* <p>Note that the default max elapsed time is {@link Long#MAX_VALUE}.
48+
* Use {@link #setMaxElapsedTime} to limit the maximum length of time that an
49+
* instance should accumulate before returning {@link BackOffExecution#STOP}.
5150
*
5251
* @author Stephane Nicoll
5352
* @since 4.1
@@ -107,7 +106,7 @@ public ExponentialBackOff(long initialInterval, double multiplier) {
107106

108107

109108
/**
110-
* The initial interval in milliseconds.
109+
* Set the initial interval in milliseconds.
111110
*/
112111
public void setInitialInterval(long initialInterval) {
113112
this.initialInterval = initialInterval;
@@ -121,7 +120,7 @@ public long getInitialInterval() {
121120
}
122121

123122
/**
124-
* The value to multiply the current interval by for each retry attempt.
123+
* Set the value to multiply the current interval by for each retry attempt.
125124
*/
126125
public void setMultiplier(double multiplier) {
127126
checkMultiplier(multiplier);
@@ -136,21 +135,21 @@ public double getMultiplier() {
136135
}
137136

138137
/**
139-
* The maximum back off time.
138+
* Set the maximum back off time in milliseconds.
140139
*/
141140
public void setMaxInterval(long maxInterval) {
142141
this.maxInterval = maxInterval;
143142
}
144143

145144
/**
146-
* Return the maximum back off time.
145+
* Return the maximum back off time in milliseconds.
147146
*/
148147
public long getMaxInterval() {
149148
return this.maxInterval;
150149
}
151150

152151
/**
153-
* The maximum elapsed time in milliseconds after which a call to
152+
* Set the maximum elapsed time in milliseconds after which a call to
154153
* {@link BackOffExecution#nextBackOff()} returns {@link BackOffExecution#STOP}.
155154
*/
156155
public void setMaxElapsedTime(long maxElapsedTime) {
@@ -184,10 +183,9 @@ private class ExponentialBackOffExecution implements BackOffExecution {
184183

185184
@Override
186185
public long nextBackOff() {
187-
if (this.currentElapsedTime >= maxElapsedTime) {
186+
if (this.currentElapsedTime >= getMaxElapsedTime()) {
188187
return STOP;
189188
}
190-
191189
long nextInterval = computeNextInterval();
192190
this.currentElapsedTime += nextInterval;
193191
return nextInterval;
@@ -214,7 +212,6 @@ private long multiplyInterval(long maxInterval) {
214212
return Math.min(i, maxInterval);
215213
}
216214

217-
218215
@Override
219216
public String toString() {
220217
StringBuilder sb = new StringBuilder("ExponentialBackOff{");

spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaDialect.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -252,24 +252,24 @@ protected DataAccessException convertHibernateAccessException(HibernateException
252252
if (ex instanceof JDBCConnectionException) {
253253
return new DataAccessResourceFailureException(ex.getMessage(), ex);
254254
}
255-
if (ex instanceof SQLGrammarException hibJdbcEx) {
256-
return new InvalidDataAccessResourceUsageException(ex.getMessage() + "; SQL [" + hibJdbcEx.getSQL() + "]", ex);
255+
if (ex instanceof SQLGrammarException hibEx) {
256+
return new InvalidDataAccessResourceUsageException(ex.getMessage() + "; SQL [" + hibEx.getSQL() + "]", ex);
257257
}
258-
if (ex instanceof QueryTimeoutException hibJdbcEx) {
259-
return new org.springframework.dao.QueryTimeoutException(ex.getMessage() + "; SQL [" + hibJdbcEx.getSQL() + "]", ex);
258+
if (ex instanceof QueryTimeoutException hibEx) {
259+
return new org.springframework.dao.QueryTimeoutException(ex.getMessage() + "; SQL [" + hibEx.getSQL() + "]", ex);
260260
}
261-
if (ex instanceof LockAcquisitionException hibJdbcEx) {
262-
return new CannotAcquireLockException(ex.getMessage() + "; SQL [" + hibJdbcEx.getSQL() + "]", ex);
261+
if (ex instanceof LockAcquisitionException hibEx) {
262+
return new CannotAcquireLockException(ex.getMessage() + "; SQL [" + hibEx.getSQL() + "]", ex);
263263
}
264-
if (ex instanceof PessimisticLockException hibJdbcEx) {
265-
return new PessimisticLockingFailureException(ex.getMessage() + "; SQL [" + hibJdbcEx.getSQL() + "]", ex);
264+
if (ex instanceof PessimisticLockException hibEx) {
265+
return new PessimisticLockingFailureException(ex.getMessage() + "; SQL [" + hibEx.getSQL() + "]", ex);
266266
}
267-
if (ex instanceof ConstraintViolationException hibJdbcEx) {
268-
return new DataIntegrityViolationException(ex.getMessage() + "; SQL [" + hibJdbcEx.getSQL() +
269-
"]; constraint [" + hibJdbcEx.getConstraintName() + "]", ex);
267+
if (ex instanceof ConstraintViolationException hibEx) {
268+
return new DataIntegrityViolationException(ex.getMessage() + "; SQL [" + hibEx.getSQL() +
269+
"]; constraint [" + hibEx.getConstraintName() + "]", ex);
270270
}
271-
if (ex instanceof DataException hibJdbcEx) {
272-
return new DataIntegrityViolationException(ex.getMessage() + "; SQL [" + hibJdbcEx.getSQL() + "]", ex);
271+
if (ex instanceof DataException hibEx) {
272+
return new DataIntegrityViolationException(ex.getMessage() + "; SQL [" + hibEx.getSQL() + "]", ex);
273273
}
274274
// end of JDBCException subclass handling
275275

spring-r2dbc/src/main/java/org/springframework/r2dbc/core/DefaultDatabaseClient.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,8 @@ private Mono<Connection> getConnection() {
166166
* @return a {@link Publisher} that completes successfully when the connection is closed
167167
*/
168168
private Publisher<Void> closeConnection(Connection connection) {
169-
return ConnectionFactoryUtils.currentConnectionFactory(
170-
obtainConnectionFactory()).then().onErrorResume(Exception.class,
171-
e -> Mono.from(connection.close()));
169+
return ConnectionFactoryUtils.currentConnectionFactory(obtainConnectionFactory()).then()
170+
.onErrorResume(Exception.class, ex -> Mono.from(connection.close()));
172171
}
173172

174173
/**

0 commit comments

Comments
 (0)