We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Class: org.springframework.retry.backoff.FixedBackOffPolicy Method: public void setBackOffPeriod(long backOffPeriod)
org.springframework.retry.backoff.FixedBackOffPolicy
public void setBackOffPeriod(long backOffPeriod)
source code:
private static final long DEFAULT_BACK_OFF_PERIOD = 1000L; private volatile long backOffPeriod = DEFAULT_BACK_OFF_PERIOD; ....//omit public void setBackOffPeriod(long backOffPeriod) { this.backOffPeriod = (backOffPeriod > 0 ? backOffPeriod : 1); //here } ....//omit
suggest code:
private static final long DEFAULT_BACK_OFF_PERIOD = 1000L; private volatile long backOffPeriod = DEFAULT_BACK_OFF_PERIOD; ....//omit public void setBackOffPeriod(long backOffPeriod) { this.backOffPeriod = (backOffPeriod > 0 ? backOffPeriod : DEFAULT_BACK_OFF_PERIOD); //here } ....//omit
The text was updated successfully, but these errors were encountered:
test code:
@Test public void fixedBackOffPolicyTest() { FixedBackOffPolicy backOffPolicy = new FixedBackOffPolicy(); backOffPolicy.setBackOffPeriod(0); RetryTemplate retryTemplate = RetryTemplate.builder() .customBackoff(backOffPolicy) .build(); Object execute = null; try { execute = retryTemplate.execute(new RetryCallback<Object, Throwable>() { @Override public Object doWithRetry(RetryContext context) throws Throwable { log.info("RetryCallback:" + context.getRetryCount()); throw new IllegalArgumentException(); //return "RetryCallback"; } }, new RecoveryCallback<Object>() { @Override public Object recover(RetryContext context) throws Exception { log.info("RecoveryCallback:" + context.getRetryCount()); return "RecoveryCallback"; } }); } catch (Throwable throwable) { log.error(throwable.getMessage(), throwable); } log.info("result:" + execute); }
Sorry, something went wrong.
No branches or pull requests
Class:
org.springframework.retry.backoff.FixedBackOffPolicy
Method:
public void setBackOffPeriod(long backOffPeriod)
source code:
suggest code:
The text was updated successfully, but these errors were encountered: