本文整理了Java中org.I0Itec.zkclient.exception.ZkInterruptedException
类的一些代码示例,展示了ZkInterruptedException
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkInterruptedException
类的具体详情如下:
包路径:org.I0Itec.zkclient.exception.ZkInterruptedException
类名称:ZkInterruptedException
暂无
代码示例来源:origin: com.101tec/zkclient
public InMemoryConnection() {
try {
create("/", null, CreateMode.PERSISTENT);
} catch (KeeperException e) {
throw ZkException.create(e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: com.alibaba.otter/shared.arbitrate
private void ensureExists(final String path) {
try {
if (zookeeper.exists(path)) {
return;
}
zookeeper.create(path, data, CreateMode.PERSISTENT);
} catch (ZkInterruptedException e) {
Thread.currentThread().interrupt();
interrupt = (InterruptedException) e.getCause();
} catch (ZkException e) {
exception = (KeeperException) e.getCause();
}
}
代码示例来源:origin: org.onap.dmaap.messagerouter.msgrtr/msgrtr
/**
* Stop the cache service.
*/
public void stopCache() {
setStatus(Status.DISCONNECTED);
final CuratorFramework curator = ConfigurationReader.getCurator();
if (curator != null) {
try {
curator.getConnectionStateListenable().removeListener(listener);
curatorConsumerCache.close();
log.info("Curator client closed");
} catch (ZkInterruptedException e) {
log.warn("Curator client close interrupted: " + e.getMessage());
} catch (IOException e) {
log.warn("Error while closing curator PathChildrenCache for KafkaConsumerCache" + e.getMessage());
}
curatorConsumerCache = null;
}
if (fSweepScheduler != null) {
fSweepScheduler.shutdownNow();
log.info("cache sweeper stopped");
}
if (fConsumers != null) {
fConsumers.clear();
fConsumers = null;
}
setStatus(Status.NOT_STARTED);
log.info("Consumer cache service stopped");
}
代码示例来源:origin: com.github.sgroschupf/zkclient
public InMemoryConnection() {
try {
create("/", null, CreateMode.PERSISTENT);
} catch (KeeperException e) {
throw ZkException.create(e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: com.101tec/zkclient
private void acquireEventLock() {
try {
getEventLock().lockInterruptibly();
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: com.alibaba.otter/shared.common
private void acquireEventLock() {
try {
getEventLock().lockInterruptibly();
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: com.github.sgroschupf/zkclient
private void acquireEventLock() {
try {
getEventLock().lockInterruptibly();
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: org.apache.helix/helix-core
private void acquireEventLock() {
try {
getEventLock().lockInterruptibly();
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: apache/helix
private void acquireEventLock() {
try {
getEventLock().lockInterruptibly();
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: com.github.sgroschupf/zkclient
private void startSingleZkServer(final int tickTime, final File dataDir, final File dataLogDir, final int port) {
try {
_zk = new ZooKeeperServer(dataDir, dataLogDir, tickTime);
_zk.setMinSessionTimeout(_minSessionTimeout);
_nioFactory = new NIOServerCnxn.Factory(new InetSocketAddress(port));
_nioFactory.startup(_zk);
} catch (IOException e) {
throw new ZkException("Unable to start single ZooKeeper server.", e);
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
}
}
代码示例来源:origin: com.github.sgroschupf/zkclient
public boolean waitForKeeperState(KeeperState keeperState, long time, TimeUnit timeUnit) throws ZkInterruptedException {
if (_zookeeperEventThread != null && Thread.currentThread() == _zookeeperEventThread) {
throw new IllegalArgumentException("Must not be done in the zookeeper event thread.");
}
Date timeout = new Date(System.currentTimeMillis() + timeUnit.toMillis(time));
LOG.debug("Waiting for keeper state " + keeperState);
acquireEventLock();
try {
boolean stillWaiting = true;
while (_currentState != keeperState) {
if (!stillWaiting) {
return false;
}
stillWaiting = getEventLock().getStateChangedCondition().awaitUntil(timeout);
}
LOG.debug("State is " + _currentState);
return true;
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
} finally {
getEventLock().unlock();
}
}
代码示例来源:origin: org.apache.helix/helix-core
public boolean waitForKeeperState(KeeperState keeperState, long time, TimeUnit timeUnit)
throws ZkInterruptedException {
if (_zookeeperEventThread != null && Thread.currentThread() == _zookeeperEventThread) {
throw new IllegalArgumentException("Must not be done in the zookeeper event thread.");
}
Date timeout = new Date(System.currentTimeMillis() + timeUnit.toMillis(time));
LOG.debug("Waiting for keeper state " + keeperState);
acquireEventLock();
try {
boolean stillWaiting = true;
while (_currentState != keeperState) {
if (!stillWaiting) {
return false;
}
stillWaiting = getEventLock().getStateChangedCondition().awaitUntil(timeout);
}
LOG.debug("State is " + (_currentState == null ? "CLOSED" : _currentState));
return true;
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
} finally {
getEventLock().unlock();
}
}
代码示例来源:origin: apache/helix
public boolean waitForKeeperState(KeeperState keeperState, long time, TimeUnit timeUnit)
throws ZkInterruptedException {
if (_zookeeperEventThread != null && Thread.currentThread() == _zookeeperEventThread) {
throw new IllegalArgumentException("Must not be done in the zookeeper event thread.");
}
Date timeout = new Date(System.currentTimeMillis() + timeUnit.toMillis(time));
LOG.debug("Waiting for keeper state " + keeperState);
acquireEventLock();
try {
boolean stillWaiting = true;
while (_currentState != keeperState) {
if (!stillWaiting) {
return false;
}
stillWaiting = getEventLock().getStateChangedCondition().awaitUntil(timeout);
}
LOG.debug("State is " + (_currentState == null ? "CLOSED" : _currentState));
return true;
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
} finally {
getEventLock().unlock();
}
}
代码示例来源:origin: com.alibaba.otter/shared.common
public boolean waitForKeeperState(KeeperState keeperState, long time, TimeUnit timeUnit)
throws ZkInterruptedException {
if (_zookeeperEventThread != null && Thread.currentThread() == _zookeeperEventThread) {
throw new IllegalArgumentException("Must not be done in the zookeeper event thread.");
}
Date timeout = new Date(System.currentTimeMillis() + timeUnit.toMillis(time));
LOG.debug("Waiting for keeper state " + keeperState);
acquireEventLock();
try {
boolean stillWaiting = true;
while (_currentState != keeperState) {
if (!stillWaiting) {
return false;
}
stillWaiting = getEventLock().getStateChangedCondition().awaitUntil(timeout);
}
LOG.debug("State is " + _currentState);
return true;
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
} finally {
getEventLock().unlock();
}
}
代码示例来源:origin: com.alibaba.otter/shared.common
throw ZkException.create(e);
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
} catch (Exception e) {
throw ExceptionUtil.convertToRuntimeException(e);
代码示例来源:origin: com.github.sgroschupf/zkclient
throw ZkException.create(e);
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
} catch (Exception e) {
throw ExceptionUtil.convertToRuntimeException(e);
代码示例来源:origin: com.101tec/zkclient
throw ZkException.create(e);
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
} catch (Exception e) {
throw ExceptionUtil.convertToRuntimeException(e);
代码示例来源:origin: com.101tec/zkclient
public boolean waitForKeeperState(KeeperState keeperState, long time, TimeUnit timeUnit) throws ZkInterruptedException {
if (_zookeeperEventThread != null && Thread.currentThread() == _zookeeperEventThread) {
throw new IllegalArgumentException("Must not be done in the zookeeper event thread.");
}
Date timeout = new Date(System.currentTimeMillis() + timeUnit.toMillis(time));
LOG.info("Waiting for keeper state " + keeperState);
acquireEventLock();
try {
boolean stillWaiting = true;
while (_currentState != keeperState) {
if (!stillWaiting) {
return false;
}
stillWaiting = getEventLock().getStateChangedCondition().awaitUntil(timeout);
// Throw an exception in the case authorization fails
if (_currentState == KeeperState.AuthFailed && _isZkSaslEnabled) {
throw new ZkAuthFailedException("Authentication failure");
}
}
LOG.debug("State is " + _currentState);
return true;
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
} finally {
getEventLock().unlock();
}
}
代码示例来源:origin: org.apache.helix/helix-core
throw ZkException.create(e);
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
} catch (Exception e) {
throw ExceptionUtil.convertToRuntimeException(e);
代码示例来源:origin: org.apache.helix/helix-core
public boolean waitUntilExists(String path, TimeUnit timeUnit, long time)
throws ZkInterruptedException {
Date timeout = new Date(System.currentTimeMillis() + timeUnit.toMillis(time));
if (LOG.isDebugEnabled()) {
LOG.debug("Waiting until znode '" + path + "' becomes available.");
}
if (exists(path)) {
return true;
}
acquireEventLock();
try {
while (!exists(path, true)) {
boolean gotSignal = getEventLock().getZNodeEventCondition().awaitUntil(timeout);
if (!gotSignal) {
return false;
}
}
return true;
} catch (InterruptedException e) {
throw new ZkInterruptedException(e);
} finally {
getEventLock().unlock();
}
}
内容来源于网络,如有侵权,请联系作者删除!