-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[improve][broker] Improve managed ledger factory async delete method parametres. #21531
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
[improve][broker] Improve managed ledger factory async delete method parametres. #21531
Conversation
| import java.util.Map; | ||
| import java.util.TreeMap; | ||
| import java.util.UUID; | ||
| import java.util.*; |
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.
nit: Please fix the code format
| DeleteLedgerCallback callback, Object ctx) { | ||
| CompletableFuture<ManagedLedgerImpl> future = ledgers.get(name); | ||
| mlConfigFuture.thenAccept(managedLedgerConfig -> { | ||
| asyncDelete(name, managedLedgerConfig, new DeleteLedgerCallback() { |
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 just pass the input callback?
| @Nonnull DeleteLedgerCallback callback, @Nullable Object ctx) { | ||
| Objects.requireNonNull(name); | ||
| Objects.requireNonNull(managedLedgerConfig); | ||
| Objects.requireNonNull(callback); |
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.
Do we have any coding guidelines for these null checks and @Nonnull annotation?
| if (future == null) { | ||
| // Managed ledger does not exist and we're not currently trying to open it | ||
| deleteManagedLedger(name, mlConfigFuture, callback, ctx); | ||
| deleteManagedLedger(name, managedLedgerConfig, callback, ctx); |
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 keep using mlConfig var name?
| * @throws ManagedLedgerException | ||
| */ | ||
| @Deprecated | ||
| void asyncDelete(String name, CompletableFuture<ManagedLedgerConfig> mlConfigFuture, |
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.
What's our plan to remove this deprecated code? Can we clean the code to make the caller use the new one?
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.
+1
Motivation
#17915 added a new public API for the managed ledger factory interface. it's not a good approach to let the user pass a future instead of the managed configuration.
Modifications
Improve the method parameters and keep the compatibility.
Verifying this change
Documentation
docdoc-requireddoc-not-neededdoc-complete