org.I0Itec.zkclient.ZkClient.unsubscribeDataChanges()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(162)

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

ZkClient.unsubscribeDataChanges介绍

暂无

代码示例

代码示例来源:origin: ltsopensource/light-task-scheduler

protected void removeTargetDataListener(String path, IZkDataListener listener) {
  zkClient.unsubscribeDataChanges(path, listener);
}

代码示例来源:origin: ltsopensource/light-task-scheduler

protected void removeTargetDataListener(String path, IZkDataListener listener) {
  zkClient.unsubscribeDataChanges(path, listener);
}

代码示例来源:origin: networknt/light-4j

@Override
public void unsubscribeDataChanges(String path, IZkDataListener dataListener) {
  zkClient.unsubscribeDataChanges(path, dataListener);
}

代码示例来源:origin: weibocom/motan

@Override
protected void unsubscribeCommand(URL url, CommandListener commandListener) {
  try {
    clientLock.lock();
    Map<CommandListener, IZkDataListener> dataChangeListeners = commandListeners.get(url);
    if (dataChangeListeners != null) {
      IZkDataListener zkDataListener = dataChangeListeners.get(commandListener);
      if (zkDataListener != null) {
        zkClient.unsubscribeDataChanges(ZkUtils.toCommandPath(url), zkDataListener);
        dataChangeListeners.remove(commandListener);
      }
    }
  } catch (Throwable e) {
    throw new MotanFrameworkException(String.format("Failed to unsubscribe command %s to zookeeper(%s), cause: %s", url, getUrl(), e.getMessage()), e);
  } finally {
    clientLock.unlock();
  }
}

代码示例来源:origin: org.apache.samza/samza-core_2.11

public void unsubscribeDataChanges(String path, IZkDataListener dataListener) {
 zkClient.unsubscribeDataChanges(path, dataListener);
}

代码示例来源:origin: apache/samza

public void unsubscribeDataChanges(String path, IZkDataListener dataListener) {
 zkClient.unsubscribeDataChanges(path, dataListener);
}

代码示例来源:origin: com.101tec/zkclient

public void stop() {
  _zkClient.unsubscribeDataChanges(_fileName, this);
}

代码示例来源:origin: org.apache.samza/samza-core_2.12

public void unsubscribeDataChanges(String path, IZkDataListener dataListener) {
 zkClient.unsubscribeDataChanges(path, dataListener);
}

代码示例来源:origin: com.github.sgroschupf/zkclient

public void stop() {
  _zkClient.unsubscribeDataChanges(_fileName, this);
}

代码示例来源:origin: org.apache.samza/samza-core

public void unsubscribeDataChanges(String path, IZkDataListener dataListener) {
 zkClient.unsubscribeDataChanges(path, dataListener);
}

代码示例来源:origin: org.apache.samza/samza-core_2.10

public void unsubscribeDataChanges(String path, IZkDataListener dataListener) {
 zkClient.unsubscribeDataChanges(path, dataListener);
}

代码示例来源:origin: com.github.ltsopensource/lts-core

protected void removeTargetDataListener(String path, IZkDataListener listener) {
  zkClient.unsubscribeDataChanges(path, listener);
}

代码示例来源:origin: com.weibo/motan-registry-zookeeper

@Override
protected void unsubscribeCommand(URL url, CommandListener commandListener) {
  try {
    clientLock.lock();
    Map<CommandListener, IZkDataListener> dataChangeListeners = commandListeners.get(url);
    if (dataChangeListeners != null) {
      IZkDataListener zkDataListener = dataChangeListeners.get(commandListener);
      if (zkDataListener != null) {
        zkClient.unsubscribeDataChanges(ZkUtils.toCommandPath(url), zkDataListener);
        dataChangeListeners.remove(commandListener);
      }
    }
  } catch (Throwable e) {
    throw new MotanFrameworkException(String.format("Failed to unsubscribe command %s to zookeeper(%s), cause: %s", url, getUrl(), e.getMessage()), e);
  } finally {
    clientLock.unlock();
  }
}

代码示例来源:origin: strimzi/strimzi-kafka-operator

@Override
public Zk unwatchData(String path) {
  workerPool().executeBlocking(
    future -> {
      try {
        IZkDataListener listener = dataWatches.remove(path);
        if (listener != null) {
          zookeeper.unsubscribeDataChanges(path, listener);
        }
        future.complete();
      } catch (Throwable t) {
        future.fail(t);
      }
    },
    log("unwatchData"));
  return this;
}

代码示例来源:origin: youtongluan/sumk

@Override
public void handleChildChange(String parentPath, List<String> currentChilds) throws Exception {
  List<String> createChilds = new ArrayList<>();
  Set<String> deleteChilds = new HashSet<>(parser.childs);
  for (String zkChild : currentChilds) {
    boolean exist = deleteChilds.remove(zkChild);
    if (!exist) {
      createChilds.add(zkChild);
    }
  }
  parser.childs = new HashSet<>(currentChilds);
  for (String create : createChilds) {
    ServerData d = parser.getZkNodeData(create);
    if (d == null) {
      continue;
    }
    parser.handle(RouteEvent.create(d.url, d.data));
    zk.subscribeDataChanges(parentPath + "/" + create, nodeListener);
  }
  for (String delete : deleteChilds) {
    parser.handle(RouteEvent.delete(Host.create(delete)));
    zk.unsubscribeDataChanges(parentPath + "/" + delete, nodeListener);
  }
}

相关文章