1、争抢锁,只有一个人能获得锁;
2、获得锁的人出问题(如果获得锁的人挂掉了,产生死锁),可使用临时节点(session);
3、获得锁的人成功了,释放锁;
4、锁被释放或被删除,别人怎么知道;
- 主动轮询、心跳....弊端:延迟、压力
- watch:可解决延迟问题....弊端:压力
- sequence + watch:watch谁?watch前一个,最小的获得锁,如果最小的释放锁,zk只给第二个发事件回调;