badfail@qq.com+java_Java KeeperException.BadArgumentsException方法代码示例

import org.apache.zookeeper.KeeperException; //导入方法依赖的package包/类

private static String getMessage(Throwable cause) {

if (cause instanceof KeeperException) {

KeeperException keeperException = (KeeperException) cause;

if (keeperException instanceof KeeperException.NoNodeException) {

return "Node does not exist: " + keeperException.getPath();

} else if (keeperException instanceof KeeperException.NoChildrenForEphemeralsException) {

return "Ephemerals cannot have children: " + keeperException.getPath();

} else if (keeperException instanceof KeeperException.NodeExistsException) {

return "Node already exists: " + keeperException.getPath();

} else if (keeperException instanceof KeeperException.NotEmptyException) {

return "Node not empty: " + keeperException.getPath();

} else if (keeperException instanceof KeeperException.NotReadOnlyException) {

return "Not a read-only call: " + keeperException.getPath();

} else if (keeperException instanceof KeeperException.InvalidACLException) {

return "Acl is not valid : " + keeperException.getPath();

} else if (keeperException instanceof KeeperException.NoAuthException) {

return "Authentication is not valid : " + keeperException.getPath();

} else if (keeperException instanceof KeeperException.BadArgumentsException) {

return "Arguments are not valid : " + keeperException.getPath();

} else if (keeperException instanceof KeeperException.BadVersionException) {

return "version No is not valid : " + keeperException.getPath();

} else if (keeperException instanceof KeeperException.ReconfigInProgress) {

return "Another reconfiguration is in progress -- concurrent " +

"reconfigs not supported (yet)";

} else if (keeperException instanceof KeeperException.NewConfigNoQuorum) {

return "No quorum of new config is connected and " +

"up-to-date with the leader of last commmitted config - try invoking reconfiguration after " +

"new servers are connected and synced";

}

}

return cause.getMessage();

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值