From 162e59944eaea0c2708451abab22f108742bb5bb Mon Sep 17 00:00:00 2001 From: sun Date: Wed, 20 Sep 2023 16:44:29 +0800 Subject: [PATCH] perf[event]: use the latest syntax --- .../main/java/com/zfoo/event/manager/EventBus.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/event/src/main/java/com/zfoo/event/manager/EventBus.java b/event/src/main/java/com/zfoo/event/manager/EventBus.java index db46e4f70..a9be1cb97 100644 --- a/event/src/main/java/com/zfoo/event/manager/EventBus.java +++ b/event/src/main/java/com/zfoo/event/manager/EventBus.java @@ -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)); } } }