Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default @Retryable has 1s blocking back-off despite docs saying otherwise #93

Open
AriApar opened this issue Nov 8, 2017 · 2 comments · Fixed by #96
Open

Default @Retryable has 1s blocking back-off despite docs saying otherwise #93

AriApar opened this issue Nov 8, 2017 · 2 comments · Fixed by #96

Comments

@AriApar
Copy link

AriApar commented Nov 8, 2017

The docs for retryable annotation state that default behaviour is no backoff:

       /**
	 * Specify the backoff properties for retrying this operation. The default is no
	 * backoff, but it can be a good idea to pause between attempts (even at the cost of
	 * blocking a thread).
	 * @return a backoff specification
	 */
	Backoff backoff() default @Backoff();

but a default @Backoff annotation would have a backoff of 1s as mentioned in:

/**
 * Collects metadata for a {@link BackOffPolicy}. Features:
 *
 * <ul>
 * <li>With no explicit settings the default is a fixed delay of 1000ms</li>
 * ...
 */
public @interface Backoff {

	/**
	 * Synonym for {@link #delay()}.
	 *
	 * @return the delay in milliseconds (default 1000)
	 */
	long value() default 1000;

and used by https://github.com/spring-projects/spring-retry/blob/master/src/main/java/org/springframework/retry/annotation/AnnotationAwareRetryOperationsInterceptor.java#L319

garyrussell added a commit to garyrussell/spring-retry that referenced this issue Nov 28, 2017
Previously, if a bean annotated with `@Retryable` and `@Recover` was
scoped "prototype", the `@Recover` method in the first instance was
called instead of the method in the same instance as the failed `@Retryable`
method.

This was because the delegate cache in `AnnotationAwareRetryOperationsInterceptor`
was keyed only on the `Method` object.

Change the cache to cache at the `targetObject.method` level.

Also fixes `backoff` javadocs.

Fixes spring-projects#93
garyrussell added a commit to garyrussell/spring-retry that referenced this issue Nov 28, 2017
Previously, if a bean annotated with `@Retryable` and `@Recover` was
scoped "prototype", the `@Recover` method in the first instance was
called instead of the method in the same instance as the failed `@Retryable`
method.

This was because the delegate cache in `AnnotationAwareRetryOperationsInterceptor`
was keyed only on the `Method` object.

Change the cache to cache at the `targetObject.method` level.

Also fixes `backoff` javadocs.

Fixes spring-projects#93
@dsyer dsyer closed this as completed in #96 Dec 5, 2017
dsyer pushed a commit that referenced this issue Dec 5, 2017
Previously, if a bean annotated with `@Retryable` and `@Recover` was
scoped "prototype", the `@Recover` method in the first instance was
called instead of the method in the same instance as the failed `@Retryable`
method.

This was because the delegate cache in `AnnotationAwareRetryOperationsInterceptor`
was keyed only on the `Method` object.

Change the cache to cache at the `targetObject.method` level.

Also fixes `backoff` javadocs.

Fixes #93
@dsyer dsyer reopened this Dec 5, 2017
@dsyer
Copy link
Member

dsyer commented Dec 5, 2017

I reverted #88 because there is a failing test for me. Not sure why yet.

@dsyer dsyer closed this as completed in a22ebe7 Dec 5, 2017
@dsyer dsyer reopened this Dec 5, 2017
@dsyer
Copy link
Member

dsyer commented Dec 5, 2017

Re-opened in case we actually want to change the default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants