mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-14 10:19:04 +00:00
ref[event]: rename
This commit is contained in:
1 parent
966fe14d89
commit
76c20ff026
5 files changed
+7
-7
No files matched your search
@@ -114,7 +114,7 @@ public abstract class EventBus {
|
||||
for (var receiver : receivers) {
|
||||
switch (receiver.bus()) {
|
||||
case CurrentThread -> doReceiver(receiver, event);
|
||||
case AsyncThread -> execute(event.executorHash(), () -> doReceiver(receiver, event));
|
||||
case AsyncThread -> asyncExecute(event.executorHash(), () -> doReceiver(receiver, event));
|
||||
// case VirtualThread -> Thread.ofVirtual().name("virtual-on" + clazz.getSimpleName()).start(() -> doReceiver(receiver, event));
|
||||
}
|
||||
}
|
||||
@@ -132,13 +132,13 @@ public abstract class EventBus {
|
||||
}
|
||||
|
||||
public static void asyncExecute(Runnable runnable) {
|
||||
execute(RandomUtils.randomInt(), runnable);
|
||||
asyncExecute(RandomUtils.randomInt(), runnable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the event thread specified by the hashcode to execute the task
|
||||
*/
|
||||
public static void execute(int executorHash, Runnable runnable) {
|
||||
public static void asyncExecute(int executorHash, Runnable runnable) {
|
||||
executors[Math.abs(executorHash % EXECUTORS_SIZE)].execute(ThreadUtils.safeRunnable(runnable));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user