1.KeeperException
This exception is thrown when a connection has been established with zookeeper, but the node information to find does not exist.
When in the process of querying node information, and Zookeeperserver lose connection, at this time Keeperexception.code is Connectionloss, then Zookeeperclient end will continue to find Zk_connection_ Retries*zk_init_retries number of times, currently, Zk_connection_retries 10 times, is the number of retries to find node information, Zk_init_retries 30 times, is the number of attempts to reconnect zookeeper server.
Where this exception may occur:
Zkcreaterecursively (String Znode, byte[] data, Boolean overwrite) method,
Getnodedata (String node, Stat Stat, Boolean retry) method, Getprimaryavataraddress (string address, Stat Stat, Boolean retry) method
GETPRIMARYAVATARADDR (String address, Stat Stat, Boolean retry) method, getprimaryavataraddress (URI address, Stat Stat, Boolean retry) method
Getnodestats (String node) method,
Getprimaryregistrationtime (URI address) method,
Exists (String address, Watcher Watcher, Boolean Namenode) method
Createephemeral (String path) method,
Deletenode (String Address) method
You should check the Zookeeper node information at this time. 2.IOException
This exception is thrown when a connection with zookeeper is failed, and prints out:
Java.net.ConnectException:Connection Refused:no further information.
Where this exception may occur:
Clearprimary (String address) method,
Clearprimarytmp (String address) method,
Registerprimary (string address, String realaddress, Boolean overwrite) method,
Registerprimary (string address, String realaddress) method,
Zkcreaterecursively (String Znode, byte[] Data,boolean overwrite) method,
Primeconnection () method,
Initzk () method,
Getnodedata (String node, Stat Stat, Boolean retry) method,
Getprimaryavataraddress (String address, Stat Stat, Boolean retry) method,
GETPRIMARYAVATARADDR (String address, Stat Stat, Boolean retry) method,
Getprimaryavataraddress (URI address, Stat Stat, Boolean retry) method,
Getnodestats (String node) method,
Getprimaryregistrationtime (URI Address) method
Exists (String address, Watcher Watcher, Boolean Namenode) method
Createephemeral (String path) method,
Deletenode (String Address) method
At this point you should check that the Zookeeper service is normal and that the network communicating with zookeeper is normal. 3. Connectexception
When initializing the zookeeperclient, that is, in the Initzk method, the state is connecting, and only when the connection succeeds will it be connected.
If the connection is not on, after a certain number of attempts (the interface will print the corresponding number of java.net.ConnectException:Connection Refused:no further information)
The current setting is 30 times and will exit the connection. and throw IOException, print "Timed out trying to connect to zookeeper".
This exception is also present when the connection is not zookeeper.
At this point you should check that the Zookeeper service is normal and that the network communicating with zookeeper is normal. 4. Interruptedexception
This exception occurs because the Zookeeperclient synchronization method is blocked at run time.
This exception is more complex to occur.
Refer to this blog:
Http://www.ibm.com/developerworks/cn/java/j-jtp05236.html
http://manming.iteye.com/blog/345595
If zookeeper stop failing, there will be interruptedexception thrown. 5.java.lang.illegalargumentexception
This exception appears when the node name is incorrectly typed when the node in zookeeper is queried. 6.UnsupportedEncodingException
Occurs when registering nodes to zookeeper and deleting nodes is unsuccessful.
Note:
All of the above are for the analysis of the Avatarzookeeperclient class.