gpt4 book ai didi

com.github.dapeng.registry.zookeeper.ZkServiceInfo.cookieRules()方法的使用及代码示例

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

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

ZkServiceInfo.cookieRules介绍

暂无

代码示例

代码示例来源:origin: dapeng-soa/dapeng-soa

/**
   * cookie injection
   */
  private static void injectCookie(String service, InvocationContextImpl context) throws SoaException {
    ZkServiceInfo zkServiceInfo = clientRefManager.serviceInfo(service);

    if (zkServiceInfo == null) {
      logger.error(InvocationContextUtils.class + "::injectCookie serviceInfo not found: " + service);
      throw new SoaException(SoaCode.NotFoundServer, "服务 [ " + service + " ] 无可用实例");
    }

    List<CookieRule> cookieRules = zkServiceInfo.cookieRules();

    if (cookieRules == null || cookieRules.size() == 0) {
      logger.debug("cookie rules 信息为空或size为0, 跳过 cookie injection");
    } else {
      CookieExecutor.injectCookies(context, cookieRules);
    }
  }
}

代码示例来源:origin: dapeng-soa/dapeng-soa

/**
 * 同步cookie注入的规则
 *
 * @param serviceInfo
 */
private void syncZkCookieRuleInfo(ZkServiceInfo serviceInfo) {
  LOGGER.warn("ClientZKAgent::syncZkCookieRuleInfo service:" + serviceInfo.serviceName());
  String servicePath = COOKIE_RULES_PATH + "/" + serviceInfo.serviceName();
  try {
    byte[] data = zk.getData(servicePath, this, null);
    List<CookieRule> cookieRules = processCookieRuleData(data);
    serviceInfo.cookieRules(cookieRules);
    LOGGER.warn("ClientZk::syncZkCookieRuleInfo rules changes:" + cookieRules);
  } catch (KeeperException.NoNodeException e) {
    ZkUtils.createPersistNodeOnly(servicePath, zk);
    syncZkCookieRuleInfo(serviceInfo);
  } catch (KeeperException | InterruptedException e) {
    LOGGER.error(getClass() + "::syncZkCookieRuleInfo serviceName: " + serviceInfo.serviceName()
        + " 出现异常, zkStatus:" + zk.getState(), e);
  }
}

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