本文整理了Java中com.github.ltsopensource.zookeeper.lts.ZkInterruptedException.<init>()
方法的一些代码示例,展示了ZkInterruptedException.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkInterruptedException.<init>()
方法的具体详情如下:
包路径:com.github.ltsopensource.zookeeper.lts.ZkInterruptedException
类名称:ZkInterruptedException
方法名:<init>
暂无
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public <T> T getData(String path) {
// 暂时不watch data change 所以第二个参数为false
try {
byte[] data = zk.getData(path, false, null);
return (T) serializer.deserialize(data);
} catch (KeeperException e) {
throw new ZkException(e);
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public <T> T getData(String path) {
// 暂时不watch data change 所以第二个参数为false
try {
byte[] data = zk.getData(path, false, null);
return (T) serializer.deserialize(data);
} catch (KeeperException e) {
throw new ZkException(e);
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
protected List<String> addTargetChildListener(String path, ChildListener childListener) {
checkConnect();
synchronized (childListeners) {
Set<ChildListener> listeners = childListeners.get(path);
if (listeners == null) {
listeners = new CopyOnWriteArraySet<ChildListener>();
childListeners.put(path, listeners);
}
listeners.add(childListener);
}
try {
zk.exists(path, true);
try {
return zk.getChildren(path, true);
} catch (KeeperException e) {
if (!isZkNoNodeException(e)) {
throw e;
}
}
} catch (KeeperException e) {
throw new ZkException(e);
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
return null;
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public boolean exists(String path) {
boolean watch = CollectionUtils.isNotEmpty(childListeners.get(path));
try {
return zk.exists(path, watch) != null;
} catch (KeeperException e) {
if (isZkNoNodeException(e)) {
return false;
} else {
throw new ZkException(e);
}
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public boolean exists(String path) {
boolean watch = CollectionUtils.isNotEmpty(childListeners.get(path));
try {
return zk.exists(path, watch) != null;
} catch (KeeperException e) {
if (isZkNoNodeException(e)) {
return false;
} else {
throw new ZkException(e);
}
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public List<String> getChildren(String path) {
boolean watch = CollectionUtils.isNotEmpty(childListeners.get(path));
try {
return zk.getChildren(path, watch);
} catch (KeeperException e) {
if (isZkNoNodeException(e)) {
return null;
} else {
throw new ZkException(e);
}
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public List<String> getChildren(String path) {
boolean watch = CollectionUtils.isNotEmpty(childListeners.get(path));
try {
return zk.getChildren(path, watch);
} catch (KeeperException e) {
if (isZkNoNodeException(e)) {
return null;
} else {
throw new ZkException(e);
}
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
protected List<String> addTargetChildListener(String path, ChildListener childListener) {
checkConnect();
synchronized (childListeners) {
Set<ChildListener> listeners = childListeners.get(path);
if (listeners == null) {
listeners = new CopyOnWriteArraySet<ChildListener>();
childListeners.put(path, listeners);
}
listeners.add(childListener);
}
try {
zk.exists(path, true);
try {
return zk.getChildren(path, true);
} catch (KeeperException e) {
if (!isZkNoNodeException(e)) {
throw e;
}
}
} catch (KeeperException e) {
throw new ZkException(e);
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
return null;
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public void setData(String path, Object data) {
byte[] bytes = serializer.serialize(data);
try {
zk.setData(path, bytes, -1);
} catch (KeeperException e) {
throw new ZkException(e);
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public void setData(String path, Object data) {
byte[] bytes = serializer.serialize(data);
try {
zk.setData(path, bytes, -1);
} catch (KeeperException e) {
throw new ZkException(e);
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public boolean delete(String path) {
try {
zk.delete(path, -1);
return true;
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
} catch (KeeperException e) {
if (isZkNoNodeException(e)) {
return false;
} else {
throw new ZkException(e);
}
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public boolean delete(String path) {
try {
zk.delete(path, -1);
return true;
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
} catch (KeeperException e) {
if (isZkNoNodeException(e)) {
return false;
} else {
throw new ZkException(e);
}
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
protected String createEphemeral(String path, Object data, boolean sequential) {
checkConnect();
final byte[] bytes = data == null ? null : serialize(data);
if (sequential) {
try {
return zk.create(path, bytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL);
} catch (KeeperException e) {
throw new ZkException("path[\" + path + \"], sequential[true] , code:" + e.code(), e);
} catch (InterruptedException e) {
throw new ZkInterruptedException("create ephemeral path[" + path + "], sequential[true]", e);
}
} else {
try {
zk.create(path, bytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
return path;
} catch (KeeperException e) {
if (isZkNodeExistsException(e)) {
// 已经存在 ignored
} else {
throw new ZkException("path[\" + path + \"], sequential[false] , code:" + e.code(), e);
}
} catch (InterruptedException e) {
throw new ZkInterruptedException("create ephemeral path[" + path + "], sequential[false]", e);
}
}
return null;
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
protected String createEphemeral(String path, Object data, boolean sequential) {
checkConnect();
final byte[] bytes = data == null ? null : serialize(data);
if (sequential) {
try {
return zk.create(path, bytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL);
} catch (KeeperException e) {
throw new ZkException("path[\" + path + \"], sequential[true] , code:" + e.code(), e);
} catch (InterruptedException e) {
throw new ZkInterruptedException("create ephemeral path[" + path + "], sequential[true]", e);
}
} else {
try {
zk.create(path, bytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
return path;
} catch (KeeperException e) {
if (isZkNodeExistsException(e)) {
// 已经存在 ignored
} else {
throw new ZkException("path[\" + path + \"], sequential[false] , code:" + e.code(), e);
}
} catch (InterruptedException e) {
throw new ZkInterruptedException("create ephemeral path[" + path + "], sequential[false]", e);
}
}
return null;
}
代码示例来源:origin: ltsopensource/light-task-scheduler
throw new ZkException("path[\" + path + \"], sequential[true] , code:" + e.code(), e);
} catch (InterruptedException e) {
throw new ZkInterruptedException("create persistent path[" + path + "], sequential[true]", e);
throw new ZkInterruptedException("create persistent path[" + path + "], sequential[false]", e);
代码示例来源:origin: ltsopensource/light-task-scheduler
throw new ZkException("path[\" + path + \"], sequential[true] , code:" + e.code(), e);
} catch (InterruptedException e) {
throw new ZkInterruptedException("create persistent path[" + path + "], sequential[true]", e);
throw new ZkInterruptedException("create persistent path[" + path + "], sequential[false]", e);
代码示例来源:origin: com.github.ltsopensource/lts-core
@Override
public <T> T getData(String path) {
// 暂时不watch data change 所以第二个参数为false
try {
byte[] data = zk.getData(path, false, null);
return (T) serializer.deserialize(data);
} catch (KeeperException e) {
throw new ZkException(e);
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: com.github.ltsopensource/lts-core
@Override
public List<String> getChildren(String path) {
boolean watch = CollectionUtils.isNotEmpty(childListeners.get(path));
try {
return zk.getChildren(path, watch);
} catch (KeeperException e) {
if (isZkNoNodeException(e)) {
return null;
} else {
throw new ZkException(e);
}
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: com.github.ltsopensource/lts-core
@Override
public void setData(String path, Object data) {
byte[] bytes = serializer.serialize(data);
try {
zk.setData(path, bytes, -1);
} catch (KeeperException e) {
throw new ZkException(e);
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: com.github.ltsopensource/lts-core
@Override
public boolean delete(String path) {
try {
zk.delete(path, -1);
return true;
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
} catch (KeeperException e) {
if (isZkNoNodeException(e)) {
return false;
} else {
throw new ZkException(e);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!