Fixes: https://github.com/spring-projects/spring-retry/issues/491
The Micrometer tag cannot be with `null` value.
When `RetryCallback` does not provide a proper `getLabel()` implementation,
the `MetricsRetryListener` fails with a `NullPointerException`
* Fix `MetricsRetryListener.close()` to fallback to the `callback.getClass().getName()`
if `callback.getLabel() == null`
* Cover behavior in the new `RetryMetricsTests.labelFallbackToClassName()`
Fixes: https://github.com/spring-projects/spring-retry/issues/488
When `@Retryable(exceptionExpression)` is used with SpEL template (`#{..}`),
a specific warning is emitted into logs indicating that such a syntax is deprecated.
* Improve that warning message pointing out what SpEL expression could be improved to
avoid this warning and future changes
Fixes: https://github.com/spring-projects/spring-retry/issues/480
* Add `flatten-maven-plugin` to resolve properties
and remove unnecessary build info from the final POM of the artifact to install/deploy
* Revert `version` extraction from POM via `sed` command in the build action
* Remove `flatten.clean` from the Maven Flatter Plugin, since `.flattened-pom.xml` generated file is landed in the `/target` dir
* Add `pomElements/profiles` for removal in the result `.flattened-pom.xml`
Since there is no `revision` property in POM, we cannot use `sed` command to extract project version from the POM.
* Use more Maven-friendly `mvn help:evaluate -Dexpression="project.version" -q -DforceStdout` command to get the current project version
* Remove tentative `finish_release_tmp.yml` since `actions\build` has been fixed now
Fixes: https://github.com/spring-projects/spring-retry/issues/477
The `Timer.Builder` from Micrometer does not create a new `Builder` instance for its `tags()` call.
So, using shared `Timer.Builder` is not OK when it can be used from concurrent calls.
* Remove shared `retryMeterProvider` property and use fresh `Timer.Builder` instance in the `MetricsRetryListener.close()`
Fixes: https://github.com/spring-projects/spring-retry/issues/476
* Add `maven-assembly-plugin` to Zip Javadocs from the `apidocs` dir into a `*-docs.zip` artifact
* Modify `build-and-deploy-snapshot.yml` and `release.yml` to assign `zip.deployed=false` attribute to Zip artifacts
* Also mark `docs.zip` files as `zip.type=docs`
Due to the absence of a `hashCode()` implementation, proxies for the `AnnotationClassOrMethodPointcut` class are regenerated each time,
which causes them to be stored in the `org.springframework.cglib.core.internal.LoadingCache` (with `RetryConfiguration.AnnotationClassOrMethodPointcut` being part of the composite key for this object).
This results in an excessive accumulation of generated proxies in memory, ultimately leading to metaspace overflow.
GH-470: Add `RetryTemplate.setLogger()` to avoid reflection in other places
Fixes: #470
Issue link: https://github.com/spring-projects/spring-retry/issues/470
Spring Cloud Config does mutation in the `RetryTemplate` for its system loading logger via `RetryTemplateFactory`.
* Expose setter for `logger` property to avoid reflection.
* Add `RetryTemplateBuilder.withLogger()` for convenience
Fixes: #229
Issue link: https://github.com/spring-projects/spring-retry/issues/229
The logic in the target `RetryPolicy` might be based on the method and its arguments we retry.
* Expose `method` & `methodArgs` `RetryContext` attributes from an internal implementation
of the `MethodInvocationRetryCallback` in the `RetryOperationsInterceptor`
* Document these attributes
Looks like that was a copy/paste artifact.
The `@Recover` is for business method purpose.
The `@Import(RetryConfiguration.class)` is done from the `@EnableRetry`
Fixes: #464
Issue link: https://github.com/spring-projects/spring-retry/issues/464
When `maxBackOffPeriod` is less than `minBackOffPeriod`, delta is taken
taken as zero in `UniformRandomBackOffPolicy` `backOff()` method.
* Update tests to use `DummySleeper`
* Extract `UniformRandomBackOffPolicy` `backOffSuppliers` into local variables
* Modify `UniformRandomBackOffPolicy` tests
Fixes: #458
* Fix code formatting violations
* * Make `retryContextToSample` as an `IdentityHashMap` and use `RetryContext` as a key
* Change `setCustomTags()` to the `@Nullable Iterable<Tag>` argument
* Use `exception = none` tag for successful executions to avoid time-series conflicts
* Add @Nullable in RetryContext to easier detect possible NPE
Both getParent() and getLastThrowable() might return null, as mentioned
in javadoc. @Nullable helps an IDE warns developers about potential NPE.
* Rephrase Javadoc for RetryContext.getLastThrowable()
* Review fixes
Fixes: #456
The random logic in the `ExponentialRandomBackOffPolicy` may end up with close to the `1`.
And after casting to `long` we got the same `1000`
* Fix test respectively to include that possibility.