gpt4 book ai didi

com.netflix.loadbalancer.ZoneAwareLoadBalancer.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 00:18:49 26 4
gpt4 key购买 nike

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

ZoneAwareLoadBalancer.<init>介绍

暂无

代码示例

代码示例来源:origin: Nepxion/Discovery

@Bean
  public ILoadBalancer ribbonLoadBalancer(IClientConfig config, ServerList<Server> serverList, ServerListFilter<Server> serverListFilter, IRule rule, IPing ping, ServerListUpdater serverListUpdater) {
    if (this.propertiesFactory.isSet(ILoadBalancer.class, serviceId)) {
      return this.propertiesFactory.get(ILoadBalancer.class, config, serviceId);
    }

    ZoneAwareLoadBalancer<?> loadBalancer = new ZoneAwareLoadBalancer<>(config, rule, ping, serverList, serverListFilter, serverListUpdater);
    loadBalanceListenerExecutor.setLoadBalancer(loadBalancer);

    return loadBalancer;
  }
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-netflix-ribbon

@Bean
@ConditionalOnMissingBean
public ILoadBalancer ribbonLoadBalancer(IClientConfig config,
    ServerList<Server> serverList, ServerListFilter<Server> serverListFilter,
    IRule rule, IPing ping, ServerListUpdater serverListUpdater) {
  if (this.propertiesFactory.isSet(ILoadBalancer.class, name)) {
    return this.propertiesFactory.get(ILoadBalancer.class, config, name);
  }
  return new ZoneAwareLoadBalancer<>(config, rule, ping, serverList,
      serverListFilter, serverListUpdater);
}

代码示例来源:origin: com.netflix.ribbon/ribbon-loadbalancer

/**
 * Build a {@link ZoneAwareLoadBalancer} with a dynamic {@link ServerList} and an {@link IRule}. The {@link ServerList} can be
 * either set in the {@link #withDynamicServerList(ServerList)} or in the {@link IClientConfig} using {@link CommonClientConfigKey#NIWSServerListClassName}.
 * The {@link IRule} can be either set by {@link #withRule(IRule)} or in the {@link IClientConfig} using
 * {@link CommonClientConfigKey#NFLoadBalancerRuleClassName}. 
 */
public ZoneAwareLoadBalancer<T> buildDynamicServerListLoadBalancer() {
  if (serverListImpl == null) {
    serverListImpl = createServerListFromConfig(config);
  }
  if (rule == null) {
    rule = createRuleFromConfig(config);
  }
  return new ZoneAwareLoadBalancer<T>(config, rule, ping, serverListImpl, serverListFilter);
}

代码示例来源:origin: com.netflix.ribbon/ribbon-loadbalancer

/**
 * Build a {@link ZoneAwareLoadBalancer} with a dynamic {@link ServerList} and an {@link IRule} and a {@link ServerListUpdater}.
 *
 * The {@link ServerList} can be either set in the {@link #withDynamicServerList(ServerList)} or in the {@link IClientConfig}
 * using {@link CommonClientConfigKey#NIWSServerListClassName}.
 * The {@link IRule} can be either set by {@link #withRule(IRule)} or in the {@link IClientConfig} using
 * {@link CommonClientConfigKey#NFLoadBalancerRuleClassName}.
 * The {@link ServerListUpdater} can be either set by {@link #withServerListUpdater(ServerListUpdater)} or
 * in the {@link IClientConfig} using {@link CommonClientConfigKey#ServerListUpdaterClassName}.
 */
public ZoneAwareLoadBalancer<T> buildDynamicServerListLoadBalancerWithUpdater() {
  if (serverListImpl == null) {
    serverListImpl = createServerListFromConfig(config);
  }
  if (rule == null) {
    rule = createRuleFromConfig(config);
  }
  if (serverListUpdater == null) {
    serverListUpdater = createServerListUpdaterFromConfig(config);
  }
  return new ZoneAwareLoadBalancer<T>(config, rule, ping, serverListImpl, serverListFilter, serverListUpdater);
}

代码示例来源:origin: org.apache.camel/camel-ribbon

private ZoneAwareLoadBalancer<RibbonServiceDefinition> createLoadBalancer(String serviceName) {
  // setup client config
  IClientConfig config = configuration.getClientName() != null
    ? IClientConfig.Builder.newBuilder(configuration.getClientName()).build()
    : IClientConfig.Builder.newBuilder().build();
  if (configuration.getProperties() != null) {
    for (Map.Entry<String, String> entry : configuration.getProperties().entrySet()) {
      IClientConfigKey key = CommonClientConfigKey.valueOf(entry.getKey());
      String value = entry.getValue();
      LOGGER.debug("RibbonClientConfig: {}={}", key.key(), value);
      config.set(key, value);
    }
  }
  ZoneAwareLoadBalancer<RibbonServiceDefinition> loadBalancer;
  if (serviceDiscovery != null) {
    loadBalancer = new ZoneAwareLoadBalancer<>(
      config,
      configuration.getRuleOrDefault(RoundRobinRule::new),
      configuration.getPingOrDefault(DummyPing::new),
      new RibbonServerList(serviceName, serviceDiscovery, serviceFilter),
      null,
      new PollingServerListUpdater(config));
  } else {
    loadBalancer = new ZoneAwareLoadBalancer<>(config);
  }
  return loadBalancer;
}

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