chore[event]: event bug document and code comments

This commit is contained in:
godotg
2022-12-06 12:48:03 +08:00
parent 469abf647f
commit dd608f60f6
3 changed files with 6 additions and 11 deletions
+1 -2
View File
@@ -135,8 +135,7 @@ public void onMyNoticeEvent(MyNoticeEvent event) {
}
// fire an event
EventBus.syncSubmit(MyNoticeEvent.valueOf("同步事件"));
EventBus.asyncSubmit(MyNoticeEvent.valueOf("异步事件"));
EventBus.submit(MyNoticeEvent.valueOf("My event"));
```
#### 7. [scheduler](scheduler/README.md) scheduling Framework Based on Cron Expression
+1 -2
View File
@@ -131,8 +131,7 @@ public void onMyNoticeEvent(MyNoticeEvent event) {
}
// 抛出一个事件
EventBus.syncSubmit(MyNoticeEvent.valueOf("同步事件"));
EventBus.asyncSubmit(MyNoticeEvent.valueOf("异步事件"));
EventBus.submit(MyNoticeEvent.valueOf("我的事件"));
```
#### 7. [scheduler](scheduler/README.md) 基于cron表达式的定时任务调度框架
@@ -26,18 +26,15 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
@Ignore
public class ApplicationTest {
// 事件总线教程,核心思想是设计模式中的观察者模式
// Event Bus tutorial, the core idea is the observer pattern.(核心思想是设计模式中的观察者模式)
@Test
public void startEventTest() {
// 加载配置文件,配置文件中必须引入event
// load the configuration file which must import event.(加载配置文件,配置文件中必须引入event)
var context = new ClassPathXmlApplicationContext("application.xml");
// 事件的接受需要在被Spring管理的bean的方法上加上@EventReceiver注解,即可自动注册事件的监听
// 参考MyController1中的标准注册方法
// see receiver method of MyController1 and MyController2
EventBus.submit(MyNoticeEvent.valueOf("我的事件"));
EventBus.submit(MyNoticeEvent.valueOf("处理事件"));
// 睡眠3秒,等待异步事件执行完
ThreadUtils.sleep(3000);
}