常见的KeeperException里,Connectionloss异常通常是可以忽略的,authfailed和session expired异常要求重新创建zookeeper客户端。其他种类的异常,根据实际业务逻辑来处理。
ZooKeeper.create
NodeExistsException NODEEXISTS - if a node with the same actual path already existsNoNodeException NONODE - if the parent node does not exist
NoChildrenForEphemeralsException NOCHILDRENFOREPHEMERALS - if the parent node of the given path is ephemeral
InvalidACLException INVALIDACL - if the ACL is invalid, null, or empty
AuthFailedException AUTHFAILED
SessionExpiredException SESSIONEXPIRED
ConnectionLossException CONNECTIONLOSS
ZooKeeper.delete
NoNodeException NONODE - if the nodes does not existBadVersionException BADVERSION - if the given version does not match the node's version
NotEmptyException NOTEMPTY - if the node has children
AuthFailedException AUTHFAILED
SessionExpiredException SESSIONEXPIRED
ConnectionLossException CONNECTIONLOSS
ZooKeeper.multi
AuthFailedException AUTHFAILEDSessionExpiredException SESSIONEXPIRED
ConnectionLossException CONNECTIONLOSS
ZooKeeper.exists
AuthFailedException AUTHFAILEDSessionExpiredException SESSIONEXPIRED
ConnectionLossException CONNECTIONLOSS
ZooKeeper.getData
NodeExistsException NODEEXISTS - if no node with the given path existsAuthFailedException AUTHFAILED
SessionExpiredException SESSIONEXPIRED
ConnectionLossException CONNECTIONLOSS
ZooKeeper.setData
NodeExistsException NODEEXISTS - if no node with the given path existsBadVersionException BADVERSION - if the given version does not match the node's version
AuthFailedException AUTHFAILED
SessionExpiredException SESSIONEXPIRED
ConnectionLossException CONNECTIONLOSS
ZooKeeper.getACL
NodeExistsException NODEEXISTS - if no node with the given path existsAuthFailedException AUTHFAILED
SessionExpiredException SESSIONEXPIRED
ConnectionLossException CONNECTIONLOSS
ZooKeeper.setACL
NodeExistsException NODEEXISTS - if no node with the given path existsBadVersionException BADVERSION - if the given version does not match the node's version
InvalidACLException INVALIDACL - if the ACL is invalid
AuthFailedException AUTHFAILED
SessionExpiredException SESSIONEXPIRED
ConnectionLossException CONNECTIONLOSS
ZooKeeper.getChildren
NodeExistsException NODEEXISTS - if no node with the given path exists
AuthFailedException AUTHFAILED
SessionExpiredException SESSIONEXPIRED
ConnectionLossException CONNECTIONLOSS