gpt4 book ai didi

org.apache.flink.runtime.zookeeper.ZooKeeperStateHandleStore.release()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 20:31:31 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.flink.runtime.zookeeper.ZooKeeperStateHandleStore.release()方法的一些代码示例,展示了ZooKeeperStateHandleStore.release()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperStateHandleStore.release()方法的具体详情如下:
包路径:org.apache.flink.runtime.zookeeper.ZooKeeperStateHandleStore
类名称:ZooKeeperStateHandleStore
方法名:release

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);

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com