-
Notifications
You must be signed in to change notification settings - Fork 467
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
Added an API on LeaseCoordinator and LeaseTaker to get all leases for… #428
Conversation
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.
Looking good, few minor changes required
/** | ||
* @return All leases | ||
*/ | ||
Collection<Lease> getAllAssignments(); |
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.
Could you rename the method to allLeases
in both the interfaces and return a list. Could you also implement a default method to the newly added methods, since they are added to publicly exposed interfaces.
default List<Lease> allLeases() {
return Collection.emptyList();
}
Could you also add javadoc for the methods
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.
Ok
*/ | ||
@Override | ||
public synchronized Collection<Lease> getAllLeases() { | ||
return Collections.unmodifiableCollection(new ArrayList<Lease>(allLeases.values())); |
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.
Just a suggestion, minimum requirement for the KCL is Java 8+. So you could get away with new ArrayList<>(allLeases.values())
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.
Updated
coordinator.runLeaseTaker(); | ||
|
||
Collection<Lease> allAssignments = coordinator.getAllAssignments(); | ||
assertEquals(allAssignments.size(), addedLeases.size()); |
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.
assertThat(..., equalTo())
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.
Updated
taker.takeLeases(); | ||
|
||
Collection<Lease> allLeases = taker.getAllLeases(); | ||
assertEquals(allLeases.size(), addedLeases.size()); |
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.
assertThat(..., equalTo)
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.
Updated
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.
Looking good, thanks for providing this.
… the application
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.