常见的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
本文详细介绍了ZooKeeper客户端操作中可能出现的各种异常情况及其原因,包括节点存在、节点不存在、版本错误等异常,并针对每种操作(如create、delete等)提供了具体的异常类型说明。
5198

被折叠的 条评论
为什么被折叠?



