Polishing

This commit is contained in:
Sam Brannen
2025-12-10 12:31:26 +01:00
parent 7c4801304d
commit ce4c9ebe3c
3 changed files with 9 additions and 9 deletions
@@ -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);