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

Add @Nullable in RetryContext to easier detect possible NPE #457

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/main/java/org/springframework/retry/RetryContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
package org.springframework.retry;

import org.springframework.core.AttributeAccessor;
import org.springframework.lang.Nullable;

/**
* Low-level access to ongoing retry operation. Normally not needed by clients, but can be
* used to alter the course of the retry, e.g. force an early termination.
*
* @author Dave Syer
* @author Emanuele Ivaldi
* @author Marcin Zajączkowski
*
*/
public interface RetryContext extends AttributeAccessor {
Expand Down Expand Up @@ -85,6 +87,7 @@ public interface RetryContext extends AttributeAccessor {
* Accessor for the parent context if retry blocks are nested.
* @return the parent or null if there is none.
*/
@Nullable
RetryContext getParent();

/**
Expand All @@ -97,9 +100,11 @@ public interface RetryContext extends AttributeAccessor {
/**
* Accessor for the exception object that caused the current retry.
* @return the last exception that caused a retry, or possibly null. It will be null
* if this is the first attempt, but also if the enclosing policy decides not to
* provide it (e.g. because of concerns about memory usage).
* if this is the first attempt and it finishes successfully, but also if the
* enclosing policy decides not to provide it (e.g. because of concerns about memory
* usage).
*/
@Nullable
Throwable getLastThrowable();

}