关于guava:一文读懂Guava-EventBus订阅发布事件

作者:京东科技 刘子洋背景最近我的项目呈现同一音讯发送屡次的景象,对上游业务方造成困扰,通过排查发现应用EventBus形式不正确。也借此机会学习了下EventBus并进行分享。以下为分享内容,本文次要分为五个局部,篇幅较长,望大家急躁浏览。 1、简述:简略介绍EventBus及其组成部分。2、原理解析:次要对listener注册流程及Event公布流程进行解析。3、应用领导:EventBus简略的应用领导。4、注意事项:在应用EventBus中须要留神的一些暗藏逻辑。5、分享时发问的问题6、我的项目中遇到的问题:上述问题进行详细描述并复现场景。1、简述1.1、概念下文摘自EventBus源码正文,从正文中能够直观理解到他的性能、个性、注意事项。 【源码正文】 Dispatches events to listeners, and provides ways for listeners to register themselves. The EventBus allows publish-subscribe-style communication between components without requiring the components to explicitly register with one another (and thus be aware of each other). It is designed exclusively to replace traditional Java in-process event distribution using explicit registration. It is not a general-purpose publish-subscribe system, nor is it intended for interprocess communication. Receiving Events ...

February 15, 2023 · 5 min · jiezi

关于guava:Google-Guava

Guava工程蕴含了若干被Google的java我的项目宽泛使依赖的外围库,例如:汇合、缓存、原生类型反对、并发库、通用注解、字符串解决、I/O等。不可变的对象当对象被不可信的库调用时,不可变的模式是平安的。不可变对象被多个线程调用时,不存在动态条件问题。不可变对象不须要思考变动,因而能够节省时间和空间。不可变对象因为固定不变,能够作为常量来平安应用。

November 27, 2022 · 1 min · jiezi