Package com.linkedin.d2.balancer.util

Examples of com.linkedin.d2.balancer.util.LoadBalancerClientCli


    // Echo servers startup
    startAllEchoServers();
    assertAllEchoServersRunning(_echoServers);
    // Get LoadBalancer Client
    _cli = new LoadBalancerClientCli(_quorum.getHosts(), "/d2");
    _client = _cli.createZKFSTogglingLBClient(_quorum.getHosts(), "/d2", null);
    assertAllEchoServersRegistered(_cli.getZKClient(), _zkUriString, _echoServers);
    assertQuorumProcessAllRequests(D2_CONFIG_DATA);
  }
View Full Code Here


    SimpleLoadBalancerState state = new SimpleLoadBalancerState(
            executorService, uriBus, clusterBus, serviceBus, _clientFactories, _loadBalancerStrategyFactories,
            _sslContext, _sslParameters, _isSSLEnabled, _clientServicesConfig);
    SimpleLoadBalancer balancer = new SimpleLoadBalancer(state, _lbTimeout, _lbTimeoutUnit);

    TogglingLoadBalancer togLB = _factory.createBalancer(balancer, state, clusterToggle, serviceToggle, uriToggle);
    togLB.start(new Callback<None>() {

      @Override
      public void onError(Throwable e)
      {
        _log.warn("Failed to run start on the TogglingLoadBalancer, may not have registered " +
View Full Code Here


    // create the load balancer
    SimpleLoadBalancer loadBalancer = new SimpleLoadBalancer(state);

    final TransportClient tc = loadBalancer.getClient(new URIRequest("d2://browsemaps/52"),
                                                      new RequestContext());
    final Client c = new TransportClientAdapter(tc);
    c.restRequest(null);
  }
View Full Code Here

  public static void testBuildAllPartitionsRequest(RestliRequestOptions options) throws ServiceUnavailableException, URISyntaxException, RestException
  {

    final int PARTITION_NUM = 10;

    ConsistentHashKeyMapper mapper = getKeyToHostMapper(PARTITION_NUM);

    AllPartitionsRequestBuilder<CollectionResponse<Greeting>> searchRB = new AllPartitionsRequestBuilder<CollectionResponse<Greeting>>(mapper);
    FindRequestBuilder<Long, Greeting> findRB = new FindRequestBuilder<Long, Greeting>(TEST_URI,
                                                                                       Greeting.class,
                                                                                       _COLL_SPEC,
View Full Code Here

  @Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "restliRequestOptions")
  public static void testSendAllPartitionsRequests(RestliRequestOptions options) throws ServiceUnavailableException, URISyntaxException, RestException, InterruptedException
  {
    final int PARTITION_NUM = 10;
    ConsistentHashKeyMapper mapper = getKeyToHostMapper(PARTITION_NUM);
    AllPartitionsRequestBuilder<Greeting> searchRB = new AllPartitionsRequestBuilder<Greeting>(mapper);
    ActionRequestBuilder<Long, Greeting> builder = new ActionRequestBuilder<Long, Greeting>(TEST_URI,
                                                                                            Greeting.class,
                                                                                            _COLL_SPEC,
                                                                                            options);
View Full Code Here

    {
      final ConsistentHashRing<URI> ring = new ConsistentHashRing<URI>(map);
      rings.add(ring);
    }

    return new ConsistentHashKeyMapper(new StaticRingProvider(rings), new TestPartitionInfoProvider());
  }
View Full Code Here

    {
      final ConsistentHashRing<URI> ring = new ConsistentHashRing<URI>(map);
      rings.add(ring);
    }

    return new ConsistentHashKeyMapper(new StaticRingProvider(rings), new TestPartitionInfoProvider());
  }
View Full Code Here

  private ZKFSLoadBalancer.TogglingLoadBalancerFactory createLoadBalancerFactory(D2ClientConfig config)
  {
    final ZKFSTogglingLoadBalancerFactoryImpl.ComponentFactory loadBalancerComponentFactory;
    if (config.componentFactory == null)
    {
      loadBalancerComponentFactory = new ZKFSComponentFactory();
    }
    else
    {
      loadBalancerComponentFactory = config.componentFactory;
    }
View Full Code Here

{

  @Override
  public LoadBalancerWithFacilities create(D2ClientConfig config)
  {
    return  new ZKFSLoadBalancer(config.zkHosts,
                                    (int) config.zkSessionTimeoutInMs,
                                    (int) config.zkStartupTimeoutInMs,
                                    createLoadBalancerFactory(config),
                                    config.flagFile,
                                    config.basePath,
View Full Code Here

    }

    final Map<String, LoadBalancerStrategyFactory<? extends LoadBalancerStrategy>> loadBalancerStrategyFactories =
        createDefaultLoadBalancerStrategyFactories();

    return new ZKFSTogglingLoadBalancerFactoryImpl(loadBalancerComponentFactory,
                                                   config.lbWaitTimeout,
                                                   config.lbWaitUnit,
                                                   config.basePath,
                                                   config.fsBasePath,
                                                   config.clientFactories,
View Full Code Here

TOP

Related Classes of com.linkedin.d2.balancer.util.LoadBalancerClientCli

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.