Package com.linkedin.d2.balancer

Examples of com.linkedin.d2.balancer.D2Client


    final Long clientStartTimeout = (Long) json.get("clientStartTimeout");

    System.out.println("Finished parsing client config");

    //create d2 client
    final D2Client d2Client = new D2ClientBuilder().setZkHosts(zkConnectString)
                                                   .setZkSessionTimeout(
                                                       zkSessionTimeout,
                                                       TimeUnit.MILLISECONDS)
                                                   .setZkStartupTimeout(
                                                       zkStartupTimeout,
View Full Code Here


                                                       TimeUnit.MILLISECONDS)
                                                   .setFlagFile(zkFlagFile)
                                                   .setBasePath(zkBasePath)
                                                   .setFsBasePath(fsBasePath);

    final D2Client normalD2Client = builder.build();
    final D2Client overrideD2Client =
        builder.setClientServicesConfig(clientServicesConfig)
               .build();

    System.out.println("Finished creating d2 clients, starting d2 clients...");
View Full Code Here

    final Long clientStartTimeout = (Long) json.get("clientStartTimeout");

    System.out.println("Finished parsing client config");

    //create d2 client
    final D2Client d2Client = new D2ClientBuilder().setZkHosts(zkConnectString)
                                                   .setZkSessionTimeout(
                                                       zkSessionTimeout,
                                                       TimeUnit.MILLISECONDS)
                                                   .setZkStartupTimeout(
                                                       zkStartupTimeout,
View Full Code Here

   *
   * The only argument is the path to the resource on the photo server, e.g. /album/1
   */
  public static void main(String[] args) throws Exception
  {
    final D2Client d2Client = new D2ClientBuilder().build();
    d2Client.start(new FutureCallback<None>());
    final RestClient restClient = new RestClient(d2Client, "d2://");
    final RestLiExampleBasicClient photoClient = new RestLiExampleBasicClient(restClient);

    photoClient.sendRequest(args[0], new PrintWriter(System.out));
    photoClient.shutdown();
View Full Code Here

    final Long clientStartTimeout = (Long) json.get("clientStartTimeout");

    System.out.println("Finished parsing client config");

    //create d2 client
    final D2Client d2Client = new D2ClientBuilder().setZkHosts(zkConnectString)
                                                   .setZkSessionTimeout(
                                                       zkSessionTimeout,
                                                       TimeUnit.MILLISECONDS)
                                                   .setZkStartupTimeout(
                                                       zkStartupTimeout,
View Full Code Here

    final Long clientStartTimeout = (Long) json.get("clientStartTimeout");
    Long rate = (Long) json.get("rateMillisecond");
    System.out.println("Finished parsing client config");

    //create d2 client
    final D2Client d2Client = new D2ClientBuilder().setZkHosts(zkConnectString)
                                                      .setZkSessionTimeout(
                                                          zkSessionTimeout,
                                                          TimeUnit.MILLISECONDS)
                                                      .setZkStartupTimeout(
                                                          zkStartupTimeout,
View Full Code Here

  @Test
  public void testRouteLookupClientFuture() throws ExecutionException, InterruptedException
  {
    RouteLookup routeLookup = new SimpleTestRouteLookup();

    final D2Client d2Client = new D2ClientBuilder().build();
    d2Client.start(new FutureCallback<None>());
    RouteLookupClient routeLookupClient = new RouteLookupClient(d2Client, routeLookup, "WestCoast");
    RestRequest dummyRestRequest = new RestRequestBuilder(URI.create("d2://simple_uri")).build();
    Future<RestResponse> future = routeLookupClient.restRequest(dummyRestRequest, "5436");
    try
    {
View Full Code Here

  public void testRouteLookupClientCallback()
    throws InterruptedException, ExecutionException, TimeoutException
  {
    RouteLookup routeLookup = new SimpleTestRouteLookup();

    final D2Client d2Client = new D2ClientBuilder().build();
    d2Client.start(new FutureCallback<None>());
    RouteLookupClient routeLookupClient = new RouteLookupClient(d2Client, routeLookup, "WestCoast");
    RestRequest dummyRestRequest = new RestRequestBuilder(URI.create("d2://simple_uri")).build();
    FutureCallback<RestResponse> futureCallback = new FutureCallback<RestResponse>();
    routeLookupClient.restRequest(dummyRestRequest,futureCallback, "5555");
View Full Code Here

  @Test
  public void testBadRequest()
  {
    RouteLookup routeLookup = new SimpleTestRouteLookup();

    final D2Client d2Client = new D2ClientBuilder().build();
    d2Client.start(new FutureCallback<None>());
    RouteLookupClient routeLookupClient = new RouteLookupClient(d2Client, routeLookup, "WestCoast");
    RestRequest dummyRestRequest = new RestRequestBuilder(URI.create("http://simple_uri")).build();
    try
    {
      Future<RestResponse> future = routeLookupClient.restRequest(dummyRestRequest, "5436");
View Full Code Here

                  _config.clientServicesConfig,
                  _config.d2ServicePath);

    final LoadBalancerWithFacilities loadBalancer = loadBalancerFactory.create(cfg);

    D2Client d2Client = new DynamicClient(loadBalancer, loadBalancer);

    /**
     * If we created default transport client factories, we need to shut them down when d2Client
     * is being shut down.
     */
 
View Full Code Here

TOP

Related Classes of com.linkedin.d2.balancer.D2Client

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.