gpt4 book ai didi

com.ke.kob.basic.constant.ZkPathConstant.clientNodePath()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 13:17:31 25 4
gpt4 key购买 nike

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

ZkPathConstant.clientNodePath介绍

暂无

代码示例

代码示例来源:origin: LianjiaTech/kob

@Override
  public Map<String, ClientPath> getClientPaths(String projectCode) {
    String clientNodePath = ZkPathConstant.clientNodePath(cluster, projectCode);
    if (!zkClient.exists(clientNodePath)) {
      return null;
    }
    List<String> nodePathStrList = zkClient.getChildren(clientNodePath);
    Map<String, ClientPath> projectClientPath = new HashMap<>(10);
    if (!KobUtils.isEmpty(nodePathStrList)) {
      for (String child : nodePathStrList) {
        ClientPath clientPath = JSONObject.parseObject(child, ClientPath.class);
        projectClientPath.put(clientPath.getIdentification(), clientPath);
      }
    }
    return projectClientPath;
  }
}

代码示例来源:origin: LianjiaTech/kob

@Override
public Map<String, ClientInfo> getClientNodes(String projectCode) {
  String clientNodePath = ZkPathConstant.clientNodePath(cluster, projectCode);
  if (!zkClient.exists(clientNodePath)) {
    return new HashMap<>(0);
  }
  List<String> nodeClientStrList = zkClient.getChildren(clientNodePath);
  Map<String, ClientInfo> projectClientNode = new HashMap<>(10);
  if (!KobUtils.isEmpty(nodeClientStrList)) {
    for (String child : nodeClientStrList) {
      ClientPath clientPath = JSONObject.parseObject(child, ClientPath.class);
      String path = ZkPathConstant.clientNodePath(cluster, projectCode) + ZkPathConstant.BACKSLASH + child;
      String dataStr = zkClient.readData(path, true);
      if (!KobUtils.isEmpty(dataStr)) {
        ClientData clientData = JSONObject.parseObject(dataStr, ClientData.class);
        projectClientNode.put(clientPath.getIdentification(), new ClientInfo(path, clientPath, clientData));
      }
    }
  }
  return projectClientNode;
}

代码示例来源:origin: LianjiaTech/kob

private void refreshClientNode(List<String> currentChilds, String project) {
  Map<String, ClientInfo> projectClientNode = new ConcurrentHashMap<>();
  if (!KobUtils.isEmpty(currentChilds)) {
    for (String child : currentChilds) {
      ClientPath clientPath = JSONObject.parseObject(child, ClientPath.class);
      String path = ZkPathConstant.clientNodePath(serverContext.getCluster(), project) + ZkPathConstant.BACKSLASH + child;
      String dataStr = zkClient.readData(path, true);
      if (!KobUtils.isEmpty(dataStr)) {
        ClientData clientData = JSONObject.parseObject(dataStr, ClientData.class);
        projectClientNode.put(clientPath.getIdentification(), new ClientInfo(path, clientPath, clientData));
      }
    }
  }
  serverContext.getClientNodeMap().put(project, projectClientNode);
}

代码示例来源:origin: LianjiaTech/kob

/**
 * 保存项目接入信息
 *
 * @return ResponseData
 */
@RequestMapping(value = "/save_project_access.json")
@ResponseBody
public ResponseData saveProjectAccess() {
  HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
  User user = (User) request.getSession().getAttribute(Attribute.SESSION_USER);
  String projectCode = request.getParameter("project_code");
  String regex = "([A-Z]|[a-z]|_){6,60}";
  if (KobUtils.isEmpty(projectCode) || !projectCode.matches(regex)) {
    return ResponseData.error("项目标识有误");
  }
  String projectName = request.getParameter("project_name");
  if (KobUtils.isEmpty(projectName) || projectName.length() > 60) {
    return ResponseData.error("项目名称有误");
  }
  boolean zkExist = zkClient.exists(ZkPathConstant.clientNodePath(cluster, projectCode));
  boolean dbExist = indexService.existProject(projectCode);
  if (zkExist || dbExist) {
    return ResponseData.error("项目已存在");
  }
  indexService.initProject(user.getCode(), user.getName(), user.getConfiguration(), projectCode, projectName);
  zkClient.createPersistent(ZkPathConstant.clientNodePath(cluster, projectCode), true);
  zkClient.createPersistent(ZkPathConstant.clientTaskPath(cluster, projectCode), true);
  return ResponseData.success();
}

代码示例来源:origin: LianjiaTech/kob

for (final String currentProjectCode : currentProjectCodeSet) {
  if (localProjectCodeSet.add(currentProjectCode)) {
    zkClient.subscribeChildChanges(ZkPathConstant.clientNodePath(serverContext.getCluster(), currentProjectCode), new IZkChildListener() {
      @Override
      public void handleChildChange(String parentPath, List<String> currentChilds) throws Exception {

代码示例来源:origin: LianjiaTech/kob

okHttpClient = okHttpClientBuilder.build();
clientTaskPath = ZkPathConstant.clientTaskPath(prop.getCluster(), prop.getProjectCode());
clientNodePath = ZkPathConstant.clientNodePath(prop.getCluster(), prop.getProjectCode());
buildKobRunner(beans);
buildClientInfo(prop);

代码示例来源:origin: LianjiaTech/kob

innerParams.setTaskPushNode(serverIdentification);
if (LoadBalanceType.NODE_HASH.name().equals(tw.getLoadBalance())) {
  List<String> clientNodePathList = zkClient.getChildren(ZkPathConstant.clientNodePath(cluster, tw.getProjectCode()));
  List<String> nodeList = new ArrayList<>();
  if (!KobUtils.isEmpty(clientNodePathList)) {

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