Skip to content

Commit

Permalink
Merge pull request #35616 from cescoffier/resteasy-reactive-score-vir…
Browse files Browse the repository at this point in the history
…tual-threads
  • Loading branch information
cescoffier authored Aug 29, 2023
2 parents c128edf + f62da89 commit cb7a296
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
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

0 comments on commit cb7a296

Please sign in to comment.