-
Notifications
You must be signed in to change notification settings - Fork 32
[FSSDK-11170] update: decision service methods for cmab #583
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
base: master
Are you sure you want to change the base?
[FSSDK-11170] update: decision service methods for cmab #583
Conversation
…e to support CMAB UUID handling
…and include CMAB UUIDs in responses
…ils for CMAB configuration
…ations over CMAB service decisions in DecisionService
…tly verify error state
…izely and DecisionService
…text and related fetcher classes
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.
Changes look good to me. Added few comments.
@Nullable ODPManager odpManager | ||
) { | ||
@Nullable ODPManager odpManager, | ||
@Nonnull CmabService cmabService |
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.
Looks like breaking change, can we make nullable?
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.
Javascript and all other server side implementations have cmabService as a mandatory field (non null). It shouldn't be breaking.
private String cmabUUID; | ||
|
||
public DecisionResponse(@Nullable T result, @Nonnull DecisionReasons reasons) { | ||
public DecisionResponse(@Nullable T result, @Nonnull DecisionReasons reasons, @Nonnull boolean error, @Nullable String cmabUUID) { |
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.
Does it impact the existing user?
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.
No, existing users can still use this class as they were. In that case cmabUUID will be set null and error will be false. Class behaviour will be same.
public int hashCode() { | ||
int result = variation != null ? variation.hashCode() : 0; | ||
result = 31 * result + (decisionSource != null ? decisionSource.hashCode() : 0); | ||
result = 31 * result + (cmabUUID != null ? cmabUUID.hashCode() : 0); |
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.
Curious to know, what is the significant of 31 here?
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.
31 is chosen as a prime number here to avoid hash collisions. Its chosen because of Java norm (googled it).
* AsyncDecisionsFetcher handles asynchronous decision fetching for multiple flag keys. | ||
* This class follows the same pattern as ODP's async segment fetching. | ||
*/ | ||
public class AsyncDecisionsFetcher extends Thread { |
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.
Can we shift the code into AysncDecisionFeatcher ?
…ecision responses
…ent key retrieval
…eation in CMAB client
Summary
Decision Service methods to handle CMAB
Test plan
Added unit tests
Issues
FSSDK-11170