本文整理汇总了Java中org.apache.zookeeper.KeeperException.BadArgumentsException类的典型用法代码示例。如果您正苦于以下问题:Java BadArgumentsException类的具体用法?Java BadArgumentsException怎么用?Java BadArgumentsException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BadArgumentsException类属于org.apache.zookeeper.KeeperException包,在下文中一共展示了BadArgumentsException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: checkAddressDuplicate
点赞 3
import org.apache.zookeeper.KeeperException.BadArgumentsException; //导入依赖的package包/类
public void checkAddressDuplicate(QuorumServer s) throws BadArgumentsException {
List<InetSocketAddress> otherAddrs = new ArrayList<InetSocketAddress>();
otherAddrs.add(s.addr);
otherAddrs.add(s.clientAddr);
otherAddrs.add(s.electionAddr);
otherAddrs = excludedSpecialAddresses(otherAddrs);
for (InetSocketAddress my: this.myAddrs) {
for (InetSocketAddress other: otherAddrs) {
if (my.equals(other)) {
String error = String.format("%s of server.%d conflicts %s of server.%d", my, this.id, other, s.id);
throw new BadArgumentsException(error);
}
}
}
}
开发者ID:didichuxing2,
项目名称:https-github.com-apache-zookeeper,
代码行数:18,
代码来源:QuorumPeer.java
示例2: validateCreateRequest
点赞 3
import org.apache.zookeeper.KeeperException.BadArgumentsException; //导入依赖的package包/类
private void validateCreateRequest(String path, CreateMode createMode, Request request, long ttl)
throws KeeperException {
try {
EphemeralType.validateTTL(createMode, ttl);
} catch (IllegalArgumentException e) {
throw new BadArgumentsException(path);
}
if (createMode.isEphemeral()) {
// Exception is set when local session failed to upgrade
// so we just need to report the error
if (request.getException() != null) {
throw request.getException();
}
zks.sessionTracker.checkGlobalSession(request.sessionId,
request.getOwner());
} else {
zks.sessionTracker.checkSession(request.sessionId,
request.getOwner());
}
}
开发者ID:didichuxing2,
项目名称:https-github.com-apache-zookeeper,
代码行数:21,
代码来源:PrepRequestProcessor.java
示例3: validatePath
点赞 2
import org.apache.zookeeper.KeeperException.BadArgumentsException; //导入依赖的package包/类
private void validatePath(String path, long sessionId) throws BadArgumentsException {
try {
PathUtils.validatePath(path);
} catch(IllegalArgumentException ie) {
LOG.info("Invalid path " + path + " with session 0x" + Long.toHexString(sessionId) +
", reason: " + ie.getMessage());
throw new BadArgumentsException(path);
}
}
开发者ID:maoling,
项目名称:fuck_zookeeper,
代码行数:10,
代码来源:PrepRequestProcessor.java
示例4: validatePathForCreate
点赞 2
import org.apache.zookeeper.KeeperException.BadArgumentsException; //导入依赖的package包/类
/**
* Performs basic validation of a path for a create request.
* Throws if the path is not valid and returns the parent path.
* @throws BadArgumentsException
*/
private String validatePathForCreate(String path, long sessionId)
throws BadArgumentsException {
int lastSlash = path.lastIndexOf('/');
if (lastSlash == -1 || path.indexOf('\0') != -1 || failCreate) {
LOG.info("Invalid path %s with session 0x%s",
path, Long.toHexString(sessionId));
throw new KeeperException.BadArgumentsException(path);
}
return path.substring(0, lastSlash);
}
开发者ID:didichuxing2,
项目名称:https-github.com-apache-zookeeper,
代码行数:16,
代码来源:PrepRequestProcessor.java
示例5: validatePath
点赞 2
import org.apache.zookeeper.KeeperException.BadArgumentsException; //导入依赖的package包/类
private void validatePath(String path, long sessionId) throws BadArgumentsException {
try {
PathUtils.validatePath(path);
} catch(IllegalArgumentException ie) {
LOG.info("Invalid path {} with session 0x{}, reason: {}",
path, Long.toHexString(sessionId), ie.getMessage());
throw new BadArgumentsException(path);
}
}
开发者ID:didichuxing2,
项目名称:https-github.com-apache-zookeeper,
代码行数:10,
代码来源:PrepRequestProcessor.java
示例6: getParentPathAndValidate
点赞 2
import org.apache.zookeeper.KeeperException.BadArgumentsException; //导入依赖的package包/类
private String getParentPathAndValidate(String path)
throws BadArgumentsException {
int lastSlash = path.lastIndexOf('/');
if (lastSlash == -1 || path.indexOf('\0') != -1
|| zks.getZKDatabase().isSpecialPath(path)) {
throw new BadArgumentsException(path);
}
return path.substring(0, lastSlash);
}
开发者ID:didichuxing2,
项目名称:https-github.com-apache-zookeeper,
代码行数:10,
代码来源:PrepRequestProcessor.java