-
Notifications
You must be signed in to change notification settings - Fork 900
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 builder for Backoff #5488
base: main
Are you sure you want to change the base?
Add builder for Backoff #5488
Conversation
return new Builder(); | ||
} | ||
|
||
public static class Builder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code style) We prefer top-level builder classes instead of nested classes.
Could you move this class to ExpontionalBackoffBuilder
?
public static Builder builder() { | ||
return new Builder(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding a builder method to each implementation, should we add a builder method Backoff
interface?
interface Backoff {
static ExpontionalBackoffBuilder builderForExpontional() {
...
}
}
Note that ExponentialBackoff
is a package-private class that users can't access.
return new ExponentialBackoff(initialDelayMillis, maxDelayMillis, multiplier); | ||
} | ||
|
||
public Builder initialDelayMillis(long initialDelayMillis) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make jitter values configured with this builder?
private long maxDelayMillis; | ||
|
||
FibonacciBackoff build() { | ||
return new FibonacciBackoff(initialDelayMillis, maxDelayMillis); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we migrate all factory methods where constructors are used into builder methods? e.g.
return new ExponentialBackoff(initialDelayMillis, maxDelayMillis, multiplier); |
35255b9
to
6ed81ab
Compare
@ikhoon Thank you for your review. I will fix it within a week. |
@kth496 Looking forward to seeing more commits in this PR 💟 |
@kth496 Any updates? |
Motivation:
Backoff
#5483Modifications:
Builder
class for various backoff implementations.Result:
Backoff
#5483