容错示例
以上图示了正常的消息流。
失败流程:
步骤 | 描述 |
---|---|
1 | Storage 抛出 StorageException 。 |
2 | CounterService 是Storage 的监管者,StorageException 被抛出时它将重启Storage 。 |
3, 4, 5, 6 | Storage 仍旧失败,又被重启. |
7 | 在5秒内三次失败和重启后Storage 被它的监管者,即CounterService 终止。 |
8 | CounterService 同时监视着并在Storage 被终止时收到Terminated 消息… |
9, 10, 11 | 告诉Counter 当前没有可用的Storage 。 |
12 | CounterService 计划一个Reconnect 消息发给自己。 |
13, 14 | 收到Reconnect 消息后它创建一个新的Storage … |
15, 16 | 并通知Counter 使用新的Storage 。 |