mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Polishing
This commit is contained in:
+1
-1
@@ -532,7 +532,7 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
|
||||
|
||||
/**
|
||||
* Callback before singleton creation.
|
||||
* <p>The default implementation register the singleton as currently in creation.
|
||||
* <p>The default implementation registers the singleton as currently in creation.
|
||||
* @param beanName the name of the singleton about to be created
|
||||
* @see #isSingletonCurrentlyInCreation
|
||||
*/
|
||||
|
||||
@@ -214,10 +214,10 @@ public class RetryTemplate implements RetryOperations {
|
||||
long elapsedTime = System.currentTimeMillis() + sleepTime - startTime;
|
||||
if (elapsedTime >= timeout) {
|
||||
String message = (sleepTime > 0 ? """
|
||||
Retry policy for operation '%s' would exceed timeout (%d ms) due \
|
||||
to pending sleep time (%d ms); preemptively aborting execution"""
|
||||
Retry policy for operation '%s' would exceed timeout (%dms) due \
|
||||
to pending sleep time (%dms); preemptively aborting execution"""
|
||||
.formatted(retryable.getName(), timeout, sleepTime) :
|
||||
"Retry policy for operation '%s' exceeded timeout (%d ms); aborting execution"
|
||||
"Retry policy for operation '%s' exceeded timeout (%dms); aborting execution"
|
||||
.formatted(retryable.getName(), timeout));
|
||||
RetryException retryException = new RetryException(message, exceptions.removeLast());
|
||||
exceptions.forEach(retryException::addSuppressed);
|
||||
|
||||
@@ -476,7 +476,7 @@ class RetryTemplateTests {
|
||||
assertThat(invocationCount).hasValue(0);
|
||||
assertThatExceptionOfType(RetryException.class)
|
||||
.isThrownBy(() -> retryTemplate.execute(retryable))
|
||||
.withMessageMatching("Retry policy for operation '.+?' exceeded timeout \\(5 ms\\); aborting execution")
|
||||
.withMessageMatching("Retry policy for operation '.+?' exceeded timeout \\(5ms\\); aborting execution")
|
||||
.withCause(new CustomException("Boom 1"))
|
||||
.satisfies(throwable -> inOrder.verify(retryListener).onRetryPolicyTimeout(
|
||||
eq(retryPolicy), eq(retryable), eq(throwable)));
|
||||
@@ -503,8 +503,8 @@ class RetryTemplateTests {
|
||||
assertThatExceptionOfType(RetryException.class)
|
||||
.isThrownBy(() -> retryTemplate.execute(retryable))
|
||||
.withMessageMatching("""
|
||||
Retry policy for operation '.+?' would exceed timeout \\(5 ms\\) \
|
||||
due to pending sleep time \\(10 ms\\); preemptively aborting execution\
|
||||
Retry policy for operation '.+?' would exceed timeout \\(5ms\\) \
|
||||
due to pending sleep time \\(10ms\\); preemptively aborting execution\
|
||||
""")
|
||||
.withCause(new CustomException("Boom 1"))
|
||||
.satisfies(throwable -> inOrder.verify(retryListener).onRetryPolicyTimeout(
|
||||
@@ -535,7 +535,7 @@ class RetryTemplateTests {
|
||||
assertThat(invocationCount).hasValue(0);
|
||||
assertThatExceptionOfType(RetryException.class)
|
||||
.isThrownBy(() -> retryTemplate.execute(retryable))
|
||||
.withMessageMatching("Retry policy for operation '.+?' exceeded timeout \\(20 ms\\); aborting execution")
|
||||
.withMessageMatching("Retry policy for operation '.+?' exceeded timeout \\(20ms\\); aborting execution")
|
||||
.withCause(new CustomException("Boom 2"))
|
||||
.satisfies(throwable -> {
|
||||
inOrder.verify(retryListener).beforeRetry(retryPolicy, retryable);
|
||||
@@ -570,7 +570,7 @@ class RetryTemplateTests {
|
||||
assertThat(invocationCount).hasValue(0);
|
||||
assertThatExceptionOfType(RetryException.class)
|
||||
.isThrownBy(() -> retryTemplate.execute(retryable))
|
||||
.withMessageMatching("Retry policy for operation '.+?' exceeded timeout \\(20 ms\\); aborting execution")
|
||||
.withMessageMatching("Retry policy for operation '.+?' exceeded timeout \\(20ms\\); aborting execution")
|
||||
.withCause(new CustomException("Boom 3"))
|
||||
.satisfies(throwable -> {
|
||||
var counter = new AtomicInteger(1);
|
||||
|
||||
Reference in New Issue
Block a user