-
Notifications
You must be signed in to change notification settings - Fork 912
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? |
@ikhoon @trustin
Question: |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5488 +/- ##
============================================
+ Coverage 74.66% 74.68% +0.01%
- Complexity 21681 21725 +44
============================================
Files 1896 1901 +5
Lines 80320 80414 +94
Branches 10548 10553 +5
============================================
+ Hits 59974 60059 +85
- Misses 15318 15324 +6
- Partials 5028 5031 +3 ☔ View full report in Codecov by Sentry. |
Motivation:
Backoff
#5483Modifications:
Builder
class for various backoff implementations.Result:
Backoff
#5483