Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
anavarr committed Jul 6, 2023
1 parent 0badc7c commit 3a53c7c
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ public void run() {
}
};
} catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) {
System.err.println(e);
//quite ugly but works
logger.warnf("You weren't able to create an executor that spawns virtual threads, the default" +
" blocking executor will be used, please check that your JDK is compatible with " +
"virtual threads");
Expand Down Expand Up @@ -114,8 +112,9 @@ public <T> Uni<T> executeWork(Context currentContext, Uni<T> uni, String workerN
return currentContext.executeBlocking(Uni.createFrom().deferred(() -> uni), ordered);
}
return executionHolder.vertx().executeBlocking(uni, ordered);
} else if (virtualThreadConcurrency.containsKey(workerName)) {
Semaphore semaphore = virtualThreadConcurrency.get(workerName);
}
Semaphore semaphore = virtualThreadConcurrency.get(workerName);
if (semaphore != null) {
boolean acquired = semaphore.tryAcquire();
if (acquired) {
return runOnVirtualThread(currentContext, uni, semaphore);
Expand Down Expand Up @@ -151,6 +150,7 @@ public <T> Uni<T> executeWork(Context currentContext, Uni<T> uni, String workerN

private <T> Uni<T> runOnVirtualThread(Context currentContext, Uni<T> uni, Semaphore semaphore) {
return uni.runSubscriptionOn(command -> VIRTUAL_EXECUTOR_SUPPLIER.get().execute(command))
.onCancellation().invoke(semaphore::release)
.onItemOrFailure().transformToUni((item, failure) -> {
semaphore.release();
return Uni.createFrom().emitter(emitter -> {
Expand Down

0 comments on commit 3a53c7c

Please sign in to comment.