Skip to content
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

Prevent CompleteableFuture$UniApply from being contextualized #247

Merged
merged 1 commit into from
Jan 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

public class SmallRyeManagedExecutor implements ManagedExecutor {

private static final String UNI_APPLY = "java.util.concurrent.CompletableFuture$UniApply";

private final SmallRyeThreadContext threadContext;
private final int maxAsync;
private final int maxQueued;
Expand Down Expand Up @@ -139,6 +141,12 @@ public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, Ti

@Override
public void execute(Runnable command) {
if (UNI_APPLY.equals(command.getClass().getName())) {
// no need to contextualize this case as this class can only be created internally by the JDK
// not by the user. It is created when a completeableFuture.thenApplyAsync is used
executeWithoutPropagation(command);
return;
}
executor.execute(threadContext.contextualRunnableUnlessContextualized(command));
}

Expand Down