13.7.16

ZooKeeper的会话与会话事件

ZooKeeper会话在ZooKeeper程序员指南中有篇幅比较大的介绍。而之前我自己对于ZK的相关了解关不多,可以趁这次的开发机会,深入了解一下。

什么是ZK会话

  • A ZooKeeper client establishes a session with the ZooKeeper service by creating a handle to the service using a language binding.
  • Once created, the handle starts of in the CONNECTING state and the client library tries to connect to one of the servers that make up the ZooKeeper service at which point it switches to the CONNECTED state.
  • During normal operation will be in one of these two states.
  • If an unrecoverable error occurs, such as session expiration or authentication failure, or if the application explicitly closes the handle, the handle will move to the CLOSED state.

No comments: