Guava eventbus 有订阅者吗?
Guava eventbus are there any subscribers?
是否可以检测 Guava Eventbus 是否有一个或多个特定事件的订阅者?
我正在使用 Guava EventBus 通过应用程序广播接收到的消息。有时我忘记注册 class 或忘记 @Subscribe 注释。
如果我能检测到这一点并在日志中写入警告就好了,但是在浏览 javadoc 时我找不到线索。
通过 javadocs 成功了:
死亡事件
https://google.github.io/guava/releases/23.0/api/docs/com/google/common/eventbus/DeadEvent.html
@Subscribe
public void handleDeadEvent(DeadEvent deadEvent) {
log.debug("no subscribers!: "+deadEvent);
}
是否可以检测 Guava Eventbus 是否有一个或多个特定事件的订阅者?
我正在使用 Guava EventBus 通过应用程序广播接收到的消息。有时我忘记注册 class 或忘记 @Subscribe 注释。
如果我能检测到这一点并在日志中写入警告就好了,但是在浏览 javadoc 时我找不到线索。
通过 javadocs 成功了: 死亡事件 https://google.github.io/guava/releases/23.0/api/docs/com/google/common/eventbus/DeadEvent.html
@Subscribe
public void handleDeadEvent(DeadEvent deadEvent) {
log.debug("no subscribers!: "+deadEvent);
}