Skip to content

Commit

Permalink
Update 12 观察者模式.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Q10Viking committed Mar 27, 2024
1 parent 98f29ca commit d0b8d27
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/designpattern/12 观察者模式.md
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,9 @@ public class TestDemo {

### 观察者与被观察者的理解

#### 基础版本
#### 监控程序版本

[Source Code](https://gitee.com/q10viking/design-patterns/tree/master/springboot-design-patterns/src/main/java/org/hzz/%E8%A1%8C%E4%B8%BA%E6%80%A7%E6%A8%A1%E5%BC%8F/BP1_%E8%A7%82%E5%AF%9F%E8%80%85%E6%A8%A1%E5%BC%8F/%E6%A1%88%E4%BE%8B/%E8%A7%82%E5%AF%9F%E8%80%85%E4%B8%8E%E8%A2%AB%E8%A7%82%E5%AF%9F%E8%80%85/%E7%9B%91%E6%8E%A7%E7%A8%8B%E5%BA%8F%E7%89%88%E6%9C%AC)

我们要解决的是李斯是怎么监控韩非子的?创建一个后台线程一直处于运行状态,一旦发现韩非子在吃饭或者娱乐就触发事件?这是真实世界的翻版,安排了一个间谍,观察韩非子的生活起居,并上报给李斯,然后李斯再触发update事件

Expand Down Expand Up @@ -846,6 +848,8 @@ public class TestDemo {

#### 引入设计模式

[Source Code](https://gitee.com/q10viking/design-patterns/tree/master/springboot-design-patterns/src/main/java/org/hzz/%E8%A1%8C%E4%B8%BA%E6%80%A7%E6%A8%A1%E5%BC%8F/BP1_%E8%A7%82%E5%AF%9F%E8%80%85%E6%A8%A1%E5%BC%8F/%E6%A1%88%E4%BE%8B/%E8%A7%82%E5%AF%9F%E8%80%85%E4%B8%8E%E8%A2%AB%E8%A7%82%E5%AF%9F%E8%80%85/%E5%BC%95%E5%85%A5%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F)

##### 被观察者Observable

```java
Expand Down

0 comments on commit d0b8d27

Please sign in to comment.