Skip to content

Conversation

@mattisonchao
Copy link
Member

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

  • Make sure that the change passes the CI checks.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Nov 7, 2023
@mattisonchao mattisonchao self-assigned this Nov 7, 2023
@mattisonchao mattisonchao added type/cleanup Code or doc cleanups e.g. remove the outdated documentation or remove the code no longer in use area/broker labels Nov 7, 2023
@mattisonchao mattisonchao added this to the 3.2.0 milestone Nov 7, 2023
import java.util.Map;
import java.util.TreeMap;
import java.util.UUID;
import java.util.*;
Copy link
Member

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() {
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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,
Copy link
Contributor

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/broker doc-not-needed Your PR changes do not impact docs ready-to-test type/cleanup Code or doc cleanups e.g. remove the outdated documentation or remove the code no longer in use

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants