Skip to content

[fix][broker] Fix MultiRolesTokenAuthorizationProvider authorize issue. - #15454

Merged
Technoboy- merged 4 commits into
apache:masterfrom
Technoboy-:fix-multi-role-future-issue
May 9, 2022
Merged

[fix][broker] Fix MultiRolesTokenAuthorizationProvider authorize issue.#15454
Technoboy- merged 4 commits into
apache:masterfrom
Technoboy-:fix-multi-role-future-issue

Conversation

@Technoboy-

@Technoboy- Technoboy- commented May 5, 2022

Copy link
Copy Markdown
Contributor

Motivation

Method authorize using the common pool thread and has a sync call :

return CompletableFuture.supplyAsync(() -> {
do {
try {
List<CompletableFuture<Boolean>> doneFutures = new ArrayList<>();
FutureUtil.waitForAny(futures).get();
for (CompletableFuture<Boolean> future : futures) {
if (!future.isDone()) {
continue;
}
doneFutures.add(future);
if (future.get()) {
futures.forEach(f -> {
if (!f.isDone()) {
f.cancel(false);
}
});
return true;
}
}
futures.removeAll(doneFutures);
} catch (InterruptedException | ExecutionException ignored) {
}
} while (!futures.isEmpty());
return false;
});

And if line-141 has an exception, the future could not complete.

Documentation

  • no-need-doc
    (Please explain why)

@Technoboy- Technoboy- self-assigned this May 5, 2022
@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label May 5, 2022
@codelipenghui codelipenghui added this to the 2.11.0 milestone May 7, 2022

@RobertIndie RobertIndie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please follow the PR title convention.

@Technoboy- Technoboy- changed the title Fix authorization provider issue. [improve][broker] Fix authorization provider issue. May 8, 2022
@Technoboy- Technoboy- changed the title [improve][broker] Fix authorization provider issue. [fix][broker] Fix MultiRolesTokenAuthorizationProvider authorize issue. May 8, 2022
@Technoboy-
Technoboy- requested a review from mattisonchao May 8, 2022 03:00
@Technoboy-
Technoboy- merged commit 19f61d5 into apache:master May 9, 2022
codelipenghui pushed a commit that referenced this pull request May 20, 2022
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request May 23, 2022
…sue. (apache#15454)

(cherry picked from commit 19f61d5)
(cherry picked from commit 836ed1e)
@mattisonchao mattisonchao added cherry-picked/branch-2.9 Archived: 2.9 is end of life and removed cherry-picked/branch-2.9 Archived: 2.9 is end of life labels May 25, 2022
codelipenghui pushed a commit that referenced this pull request Jun 10, 2022
@codelipenghui codelipenghui added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label Jun 10, 2022
BewareMyPower pushed a commit that referenced this pull request Jul 27, 2022
…sue. (#15454)

(cherry picked from commit 19f61d5)

To resolve the conflicts, change `FutureUtil#waitForAny`'s parameter
from `Collection` to `List` since #15329 cannot be cherry-picked.
@BewareMyPower BewareMyPower added the cherry-picked/branch-2.8 Archived: 2.8 is end of life label Jul 27, 2022
@Technoboy-
Technoboy- deleted the fix-multi-role-future-issue branch August 10, 2022 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants