-
Notifications
You must be signed in to change notification settings - Fork 207
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
Modify AcknowledgementSet add API to accept EventHandle instead of Event #4948
Modify AcknowledgementSet add API to accept EventHandle instead of Event #4948
Conversation
* @since 2.2 | ||
*/ | ||
public void add(Event event); | ||
public void add(EventHandle eventHandle); |
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.
Why not support both for now?
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.
Because it is not required. Do you mean we should support it just so the number of code changes would be less? If that matters, we could support both.
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.
Modified to support both using a default method in the interface.
eventHandle.addAcknowledgementSet(acknowledgementSet1); | ||
eventHandle.addAcknowledgementSet(acknowledgementSet2); | ||
AggregateEventHandle eventHandle2 = new AggregateEventHandle(now); | ||
doNothing().when(acknowledgementSet1).add(any(EventHandle.class)); |
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.
I don't think you need these doNothing()
calls. This should be the default.
@@ -452,7 +452,7 @@ private void processRecord(final AcknowledgementSet acknowledgementSet, final Re | |||
// buffer contents before the event record is added | |||
// to acknowledgement set | |||
if (acknowledgementSet != null) { | |||
acknowledgementSet.add(record.getData()); | |||
acknowledgementSet.add(((Event)record.getData()).getEventHandle()); |
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.
If we continue to support add(Event)
then all of this code should be simpler and you can remove for this PR.
acknowledgementSet = mock(AcknowledgementSet.class); | ||
eventHandle.addAcknowledgementSet(acknowledgementSet); | ||
DefaultEventHandle eventHandle2 = new DefaultEventHandle(now); | ||
doNothing().when(acknowledgementSet).add(any(EventHandle.class)); |
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.
I don't think you need this line.
totalEventsAdded.incrementAndGet(); | ||
} | ||
InternalEventHandle internalEventHandle; | ||
if (eventHandle instanceof AggregateEventHandle) { |
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.
Why do you have this condition?
These lines should just become:
InternalEventHandle internalEventHandle = (InternalEventHandle) eventHandle;
30b46c6
to
95d0d7d
Compare
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
87bbd60
to
aa3e2d5
Compare
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
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.
Thank you @kkondaka !
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
Description
Modify AcknowledgementSet add API to accept EventHandle instead of Event.
This is part of supporting acknowledgements in aggregate processor (local mode).
Issues Resolved
Resolves #[Issue number to be closed when this PR is merged]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.