Skip to content

Commit

Permalink
perf[event]: use the latest syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysunxiao committed Sep 20, 2023
1 parent effc003 commit 162e599
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions event/src/main/java/com/zfoo/event/manager/EventBus.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,9 @@ public static void post(IEvent event) {
}
for (var receiver : receivers) {
switch (receiver.bus()) {
case CurrentThread:
doReceiver(receiver, event);
break;
case AsyncThread:
execute(event.executorHash(), () -> doReceiver(receiver, event));
break;
case VirtualThread:
Thread.ofVirtual().name("virtual-" + clazz.getSimpleName()).start(ThreadUtils.safeRunnable(() -> doReceiver(receiver, event)));
break;
case CurrentThread -> doReceiver(receiver, event);
case AsyncThread -> execute(event.executorHash(), () -> doReceiver(receiver, event));
case VirtualThread -> Thread.ofVirtual().name("virtual-on" + clazz.getSimpleName()).start(() -> doReceiver(receiver, event));
}
}
}
Expand Down

0 comments on commit 162e599

Please sign in to comment.