Package com.linkedin.d2.balancer

Examples of com.linkedin.d2.balancer.D2Client.start()


   * 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


  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

    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

  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

                                    loadBalancerStrategyFactories,
                                    null, null, false);

    SimpleLoadBalancer balancer = new SimpleLoadBalancer(state, 5, TimeUnit.SECONDS);
    FutureCallback<None> callback = new FutureCallback<None>();
    balancer.start(callback);
    callback.get(5, TimeUnit.SECONDS);

    new JmxManager().registerLoadBalancer("balancer", balancer)
                    .registerLoadBalancerState("state", state)
                    .registerScheduledThreadPoolExecutor("executorService", executor)
View Full Code Here

            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

    PropertyEventThread thread = new PropertyEventThread("echo client event thread");
    ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory(
                        "echo client event thread"));

    // start up the world
    thread.start();

    PropertyEventBus<ServiceProperties> serviceBus =
        new PropertyEventBusImpl<ServiceProperties>(executorService, zkServiceRegistry);
    serviceBus.register(fsServiceStore);
    new ZooKeeperTogglingStore<ServiceProperties>(zkServiceRegistry,
View Full Code Here

    PropertyTestEvent testEvent = new PropertyTestEvent("counter");

    // Test doesn't make sense with hacked PropertyEventThread
    //assertFalse(thread.send(testEvent));

    thread.start();

    assertTrue(thread.send(testEvent));
    assertTrue(thread.send(testEvent));

    thread.interrupt();
View Full Code Here

      callback.get(30, TimeUnit.SECONDS);

      Directory dir = balancer.getDirectory();

      ZKConnection conn = new ZKConnection("localhost:" + PORT, 30000);
      conn.start();

      ZooKeeperPermanentStore<ServiceProperties> store =
              new ZooKeeperPermanentStore<ServiceProperties>(conn, new ServicePropertiesJsonSerializer(), ZKFSUtil.servicePath(BASE_PATH));
      callback = new FutureCallback<None>();
      store.start(callback);
View Full Code Here

      callback.get(30, TimeUnit.SECONDS);

      Directory dir = balancer.getDirectory();

      ZKConnection conn = new ZKConnection("localhost:" + PORT, 30000);
      conn.start();

      ZooKeeperPermanentStore<ClusterProperties> store =
              new ZooKeeperPermanentStore<ClusterProperties>(conn, new ClusterPropertiesJsonSerializer(),
                                                             ZKFSUtil.clusterPath(BASE_PATH));
      callback = new FutureCallback<None>();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.