本文整理了Java中org.apache.flink.runtime.zookeeper.ZooKeeperStateHandleStore.release()
方法的一些代码示例,展示了ZooKeeperStateHandleStore.release()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperStateHandleStore.release()
方法的具体详情如下:
包路径:org.apache.flink.runtime.zookeeper.ZooKeeperStateHandleStore
类名称:ZooKeeperStateHandleStore
方法名:release
[英]Releases the lock from the node under the given ZooKeeper path. If no lock exists, then nothing happens.
[中]从给定ZooKeeper路径下的节点释放锁。如果不存在锁,则什么也不会发生。
代码示例来源:origin: org.apache.flink/flink-runtime
@Override
public void releaseJobGraph(JobID jobId) throws Exception {
checkNotNull(jobId, "Job ID");
final String path = getPathForJob(jobId);
LOG.debug("Releasing locks of job graph {} from {}{}.", jobId, zooKeeperFullBasePath, path);
synchronized (cacheLock) {
if (addedJobGraphs.contains(jobId)) {
jobGraphsInZooKeeper.release(path);
addedJobGraphs.remove(jobId);
}
}
LOG.info("Released locks of job graph {} from ZooKeeper.", jobId);
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.11
@Override
public void releaseJobGraph(JobID jobId) throws Exception {
checkNotNull(jobId, "Job ID");
final String path = getPathForJob(jobId);
LOG.debug("Releasing locks of job graph {} from {}{}.", jobId, zooKeeperFullBasePath, path);
synchronized (cacheLock) {
if (addedJobGraphs.contains(jobId)) {
jobGraphsInZooKeeper.release(path);
addedJobGraphs.remove(jobId);
}
}
LOG.info("Released locks of job graph {} from ZooKeeper.", jobId);
}
代码示例来源:origin: com.alibaba.blink/flink-runtime
/**
* Releases all lock nodes of this ZooKeeperStateHandleStore.
*
* @throws Exception if the delete operation of a lock file fails
*/
public void releaseAll() throws Exception {
Collection<String> children = getAllPaths();
Exception exception = null;
for (String child: children) {
try {
release(child);
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
}
if (exception != null) {
throw new Exception("Could not properly release all state nodes.", exception);
}
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.10
/**
* Releases all lock nodes of this ZooKeeperStateHandleStore.
*
* @throws Exception if the delete operation of a lock file fails
*/
public void releaseAll() throws Exception {
Collection<String> children = getAllPaths();
Exception exception = null;
for (String child: children) {
try {
release(child);
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
}
if (exception != null) {
throw new Exception("Could not properly release all state nodes.", exception);
}
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.11
/**
* Releases all lock nodes of this ZooKeeperStateHandleStore.
*
* @throws Exception if the delete operation of a lock file fails
*/
public void releaseAll() throws Exception {
Collection<String> children = getAllPaths();
Exception exception = null;
for (String child: children) {
try {
release(child);
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
}
if (exception != null) {
throw new Exception("Could not properly release all state nodes.", exception);
}
}
代码示例来源:origin: org.apache.flink/flink-runtime
/**
* Releases all lock nodes of this ZooKeeperStateHandleStore.
*
* @throws Exception if the delete operation of a lock file fails
*/
public void releaseAll() throws Exception {
Collection<String> children = getAllPaths();
Exception exception = null;
for (String child: children) {
try {
release(child);
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
}
if (exception != null) {
throw new Exception("Could not properly release all state nodes.", exception);
}
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.11
/**
* Releases the lock for the given state node and tries to remove the state node if it is no longer locked.
* It returns the {@link RetrievableStateHandle} stored under the given state node if any.
*
* @param pathInZooKeeper Path of state handle to remove
* @return True if the state handle could be released
* @throws Exception If the ZooKeeper operation or discarding the state handle fails
*/
@Nullable
public boolean releaseAndTryRemove(String pathInZooKeeper) throws Exception {
checkNotNull(pathInZooKeeper, "Path in ZooKeeper");
final String path = normalizePath(pathInZooKeeper);
RetrievableStateHandle<T> stateHandle = null;
try {
stateHandle = get(path, false);
} catch (Exception e) {
LOG.warn("Could not retrieve the state handle from node {}.", path, e);
}
release(pathInZooKeeper);
try {
client.delete().forPath(path);
} catch (KeeperException.NotEmptyException ignored) {
LOG.debug("Could not delete znode {} because it is still locked.", path);
return false;
}
if (stateHandle != null) {
stateHandle.discardState();
}
return true;
}
代码示例来源:origin: org.apache.flink/flink-runtime
/**
* Releases the lock for the given state node and tries to remove the state node if it is no longer locked.
* It returns the {@link RetrievableStateHandle} stored under the given state node if any.
*
* @param pathInZooKeeper Path of state handle to remove
* @return True if the state handle could be released
* @throws Exception If the ZooKeeper operation or discarding the state handle fails
*/
@Nullable
public boolean releaseAndTryRemove(String pathInZooKeeper) throws Exception {
checkNotNull(pathInZooKeeper, "Path in ZooKeeper");
final String path = normalizePath(pathInZooKeeper);
RetrievableStateHandle<T> stateHandle = null;
try {
stateHandle = get(path, false);
} catch (Exception e) {
LOG.warn("Could not retrieve the state handle from node {}.", path, e);
}
release(pathInZooKeeper);
try {
client.delete().forPath(path);
} catch (KeeperException.NotEmptyException ignored) {
LOG.debug("Could not delete znode {} because it is still locked.", path);
return false;
}
if (stateHandle != null) {
stateHandle.discardState();
}
return true;
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.10
} finally {
if (!success) {
jobGraphsInZooKeeper.release(path);
代码示例来源:origin: com.alibaba.blink/flink-runtime
if (!success && lock) {
release(path);
代码示例来源:origin: com.alibaba.blink/flink-runtime
/**
* Releases the lock for the given state node and tries to remove the state node if it is no longer locked.
* The deletion of the state node is executed asynchronously. After the state node has been deleted, the given
* callback is called with the {@link RetrievableStateHandle} of the deleted state node.
*
* <p><strong>Important</strong>: This also discards the stored state handle after the given action
* has been executed.
*
* @param pathInZooKeeper Path of state handle to remove
* @param callback The callback to execute after a successful deletion. Null if no action needs to be executed.
* @throws Exception If the ZooKeeper operation fails
*/
public void releaseAndTryRemove(
String pathInZooKeeper,
@Nullable final RemoveCallback<T> callback) throws Exception {
checkNotNull(pathInZooKeeper, "Path in ZooKeeper");
final String path = normalizePath(pathInZooKeeper);
RetrievableStateHandle<T> stateHandle = null;
try {
stateHandle = get(path, false);
} catch (Exception e) {
LOG.warn("Could not retrieve the state handle from node " + path + '.', e);
}
release(pathInZooKeeper);
final BackgroundCallback backgroundCallback = new RemoveBackgroundCallback<>(stateHandle, callback, path);
client.delete().inBackground(backgroundCallback, executor).forPath(path);
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.10
/**
* Releases the lock for the given state node and tries to remove the state node if it is no longer locked.
* The deletion of the state node is executed asynchronously. After the state node has been deleted, the given
* callback is called with the {@link RetrievableStateHandle} of the deleted state node.
*
* <p><strong>Important</strong>: This also discards the stored state handle after the given action
* has been executed.
*
* @param pathInZooKeeper Path of state handle to remove
* @param callback The callback to execute after a successful deletion. Null if no action needs to be executed.
* @throws Exception If the ZooKeeper operation fails
*/
public void releaseAndTryRemove(
String pathInZooKeeper,
@Nullable final RemoveCallback<T> callback) throws Exception {
checkNotNull(pathInZooKeeper, "Path in ZooKeeper");
final String path = normalizePath(pathInZooKeeper);
RetrievableStateHandle<T> stateHandle = null;
try {
stateHandle = get(path, false);
} catch (Exception e) {
LOG.warn("Could not retrieve the state handle from node " + path + '.', e);
}
release(pathInZooKeeper);
final BackgroundCallback backgroundCallback = new RemoveBackgroundCallback<>(stateHandle, callback, path);
client.delete().inBackground(backgroundCallback, executor).forPath(path);
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.10
if (!success && lock) {
release(path);
代码示例来源:origin: com.alibaba.blink/flink-runtime
} finally {
if (!success) {
jobGraphsInZooKeeper.release(path);
代码示例来源:origin: org.apache.flink/flink-runtime_2.11
} finally {
if (!success) {
jobGraphsInZooKeeper.release(path);
代码示例来源:origin: org.apache.flink/flink-runtime
} finally {
if (!success) {
jobGraphsInZooKeeper.release(path);
代码示例来源:origin: org.apache.flink/flink-runtime
if (!success && lock) {
release(path);
代码示例来源:origin: org.apache.flink/flink-runtime_2.11
if (!success && lock) {
release(path);
内容来源于网络,如有侵权,请联系作者删除!