An inconsistent configuration of Spring Retry can lead to blocking thread and therefore increase energy usage.
Rule complete description
Text
With Spring Retry, we can make operation retryable but configuration can be inconsistent with too many retries, or too long retry period which can lead to increase energy usage.
This rule only focuses on the use of Retry with annotation @Retryable
This rule needs a threshold max.timeout the maximum time out acceptable for blocking ressource (ms).
Example:
@Retryable(maxAttempts = 5, backoff = @Backoff(delay = 10))
void retryService(String sql);
// here max is 50 ms
HTML
<p>Using <code>@Retryable</code> can lead to increase energy usage.</p>
<p>Limit the configuration of the retry to prevent too large time blocking thread `max.timeout=50000`.</p>
<h2>Noncompliant Code Example, timeout = 10_000_000</h2>
<pre>
@Retryable(maxAttempts = 4, backoff = @Backoff(delay = 10, multiplier = 100))
void retryService(String sql);
</pre>
Implementation principle
Search annotation @Retryable on method
Get the value in maxAttempts, delay and multiplier
Interesting rule for its subject. Missing to find a good "max.timeout" and to justify the rule. May be a good example for measure validation in the next hackaton.
\newpage
Spring Retry: Inconsistent configuration
Platform
Main caracteristics
Severity / Remediation Cost
Rule short description
An inconsistent configuration of Spring Retry can lead to blocking thread and therefore increase energy usage.
Rule complete description
Text
With Spring Retry, we can make operation retryable but configuration can be inconsistent with too many retries, or too long retry period which can lead to increase energy usage.
This rule only focuses on the use of Retry with annotation
@Retryable
This rule needs a thresholdmax.timeout
the maximum time out acceptable for blocking ressource (ms).Example:
HTML
Implementation principle
@Retryable
on methodmaxAttempts
,delay
andmultiplier
max.timeout
max.timeout
, report the line