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

Add virtual thread support to the resteasy reactive scoring system #35616

Merged
Merged
Show file tree
Hide file tree
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 @@ -218,21 +218,23 @@ public RuntimeResource buildResourceMethod(ResourceClass clazz,
if (method.isBlocking()) {
if (method.isRunOnVirtualThread()) {
handlers.add(blockingHandlerVirtualThread);
score.add(ScoreSystem.Category.Execution, ScoreSystem.Diagnostic.ExecutionVirtualThread);
} else {
handlers.add(blockingHandler);
score.add(ScoreSystem.Category.Execution, ScoreSystem.Diagnostic.ExecutionBlocking);
}
blockingHandlerIndex = Optional.of(handlers.size() - 1);
score.add(ScoreSystem.Category.Execution, ScoreSystem.Diagnostic.ExecutionBlocking);
} else {
if (method.isRunOnVirtualThread()) {
//should not happen
log.error("a method was both non blocking and @RunOnVirtualThread, it is now considered " +
log.error("a method was both non-blocking and @RunOnVirtualThread, it is now considered " +
"@RunOnVirtual and blocking");
handlers.add(blockingHandlerVirtualThread);
score.add(ScoreSystem.Category.Execution, ScoreSystem.Diagnostic.ExecutionVirtualThread);
} else {
handlers.add(NonBlockingHandler.INSTANCE);
score.add(ScoreSystem.Category.Execution, ScoreSystem.Diagnostic.ExecutionNonBlocking);
}
score.add(ScoreSystem.Category.Execution, ScoreSystem.Diagnostic.ExecutionNonBlocking);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public String toString() {
public static Diagnostic ExecutionNonBlocking = new Diagnostic("Dispatched on the IO thread", 100);
public static Diagnostic ExecutionBlocking = new Diagnostic("Relies on a blocking worker thread", 0);

public static Diagnostic ExecutionVirtualThread = new Diagnostic("Relies on a virtual thread", 66);

public static Diagnostic ResourceSingleton = new Diagnostic("Single resource instance for all requests", 100);
public static Diagnostic ResourcePerRequest = new Diagnostic("New resource instance for every request", 0);

Expand Down