添加对zookeeper连接状态的监控
diff --git a/dubbo/client.py b/dubbo/client.py
index 279f7ff..991eef5 100644
--- a/dubbo/client.py
+++ b/dubbo/client.py
@@ -6,6 +6,7 @@
 from urllib import quote
 
 from kazoo.client import KazooClient
+from kazoo.protocol.states import KazooState
 
 from dubbo.common.constants import DUBBO_ZK_PROVIDERS, DUBBO_ZK_CONFIGURATORS, DUBBO_ZK_CONSUMERS
 from dubbo.common.exceptions import RegisterException
@@ -101,6 +102,8 @@
         :param application_name: 当前客户端的名称
         """
         zk = KazooClient(hosts=hosts)
+        # 对zookeeper连接状态的监控
+        zk.add_listener(self.state_listener)
         zk.start()
 
         self.zk = zk
@@ -109,6 +112,16 @@
         self.application_name = application_name
         self.lock = threading.Lock()
 
+    @staticmethod
+    def state_listener(state):
+        logger.debug('Current state -> {}'.format(state))
+        if state == KazooState.LOST:
+            logger.debug('The session to register has lost.')
+        elif state == KazooState.SUSPENDED:
+            logger.debug('Disconnected from zookeeper.')
+        else:
+            logger.debug('Connected or disconnected to zookeeper.')
+
     def get_provider_host(self, interface):
         """
         从zk中可以根据接口名称获取到此接口某个provider的host