Package co.cask.cdap.common.discovery

Examples of co.cask.cdap.common.discovery.RandomEndpointStrategy


  public void getWorkflowStatus(String accountId, String appId, String workflowId, final Callback callback)
                      throws IOException, ExecutionException, InterruptedException {
    // determine the service provider for the given path
    String serviceName = String.format("workflow.%s.%s.%s", accountId, appId, workflowId);
    Discoverable discoverable = new RandomEndpointStrategy(discoveryServiceClient.discover(serviceName)).pick();

    if (discoverable == null) {
      LOG.debug("No endpoint for service {}", serviceName);
      callback.handle(new Status(Status.Code.NOT_FOUND, ""));
      return;
View Full Code Here


  public URL getServiceURL(final String applicationId, final String serviceId) {
    ServiceDiscovered serviceDiscovered = discoveryServiceClient.discover(String.format("service.%s.%s.%s",
                                                                                        getAccountId(),
                                                                                        applicationId,
                                                                                        serviceId));
    EndpointStrategy endpointStrategy = new RandomEndpointStrategy(serviceDiscovered);
    Discoverable discoverable = endpointStrategy.pick();
    if (discoverable != null) {
      return createURL(discoverable, applicationId, serviceId);
    }

    final SynchronousQueue<URL> discoverableQueue = new SynchronousQueue<URL>();
View Full Code Here

  public DiscoveryExploreClient(final DiscoveryServiceClient discoveryClient) {
    this.endpointStrategySupplier = Suppliers.memoize(new Supplier<EndpointStrategy>() {
      @Override
      public EndpointStrategy get() {
        return new TimeLimitEndpointStrategy(
          new RandomEndpointStrategy(
            discoveryClient.discover(Service.EXPLORE_HTTP_USER_SERVICE)), 3L, TimeUnit.SECONDS);
      }
    });
  }
View Full Code Here

TOP

Related Classes of co.cask.cdap.common.discovery.RandomEndpointStrategy

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.