gpt4 book ai didi

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

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

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

ZooKeeperStateHandleStore.get介绍

[英]Gets a state handle from ZooKeeper and optionally locks it.
[中]从ZooKeeper获取状态句柄,并可以选择将其锁定。

代码示例

代码示例来源:origin: org.apache.flink/flink-runtime

/**
 * Gets the {@link RetrievableStateHandle} stored in the given ZooKeeper node and locks it. A
 * locked node cannot be removed by another {@link ZooKeeperStateHandleStore} instance as long
 * as this instance remains connected to ZooKeeper.
 *
 * @param pathInZooKeeper Path to the ZooKeeper node which contains the state handle
 * @return The retrieved state handle from the specified ZooKeeper node
 * @throws IOException Thrown if the method failed to deserialize the stored state handle
 * @throws Exception Thrown if a ZooKeeper operation failed
 */
public RetrievableStateHandle<T> getAndLock(String pathInZooKeeper) throws Exception {
  return get(pathInZooKeeper, true);
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.10

/**
 * Gets the {@link RetrievableStateHandle} stored in the given ZooKeeper node and locks it. A
 * locked node cannot be removed by another {@link ZooKeeperStateHandleStore} instance as long
 * as this instance remains connected to ZooKeeper.
 *
 * @param pathInZooKeeper Path to the ZooKeeper node which contains the state handle
 * @return The retrieved state handle from the specified ZooKeeper node
 * @throws IOException Thrown if the method failed to deserialize the stored state handle
 * @throws Exception Thrown if a ZooKeeper operation failed
 */
public RetrievableStateHandle<T> getAndLock(String pathInZooKeeper) throws Exception {
  return get(pathInZooKeeper, true);
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

/**
 * Gets the {@link RetrievableStateHandle} stored in the given ZooKeeper node and locks it. A
 * locked node cannot be removed by another {@link ZooKeeperStateHandleStore} instance as long
 * as this instance remains connected to ZooKeeper.
 *
 * @param pathInZooKeeper Path to the ZooKeeper node which contains the state handle
 * @return The retrieved state handle from the specified ZooKeeper node
 * @throws IOException Thrown if the method failed to deserialize the stored state handle
 * @throws Exception Thrown if a ZooKeeper operation failed
 */
public RetrievableStateHandle<T> getAndLock(String pathInZooKeeper) throws Exception {
  return get(pathInZooKeeper, true);
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

/**
 * Gets the {@link RetrievableStateHandle} stored in the given ZooKeeper node and locks it. A
 * locked node cannot be removed by another {@link ZooKeeperStateHandleStore} instance as long
 * as this instance remains connected to ZooKeeper.
 *
 * @param pathInZooKeeper Path to the ZooKeeper node which contains the state handle
 * @return The retrieved state handle from the specified ZooKeeper node
 * @throws IOException Thrown if the method failed to deserialize the stored state handle
 * @throws Exception Thrown if a ZooKeeper operation failed
 */
public RetrievableStateHandle<T> getAndLock(String pathInZooKeeper) throws Exception {
  return get(pathInZooKeeper, 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.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_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: 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.11

RetrievableStateHandle<T> oldStateHandle = get(path, false);

代码示例来源:origin: com.alibaba.blink/flink-runtime

RetrievableStateHandle<T> oldStateHandle = get(path, false);

代码示例来源:origin: org.apache.flink/flink-runtime

RetrievableStateHandle<T> oldStateHandle = get(path, false);

代码示例来源:origin: org.apache.flink/flink-runtime_2.10

RetrievableStateHandle<T> oldStateHandle = get(path, false);

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