Package org.apache.curator.x.discovery

Examples of org.apache.curator.x.discovery.ServiceInstance


  }

  @Override
  public Server pick()
  {
    final ServiceInstance instance;
    try {
      instance = serviceProvider.getInstance();
    }
    catch (Exception e) {
      log.info(e, "Exception getting instance");
      return null;
    }

    if (instance == null) {
      log.error("No server instance found");
      return null;
    }

    return new Server()
    {
      @Override
      public String getHost()
      {
        return String.format("%s:%d", getAddress(), getPort());
      }

      @Override
      public String getAddress()
      {
        return instance.getAddress();
      }

      @Override
      public int getPort()
      {
        return instance.getPort();
      }

      @Override
      public String getScheme()
      {
View Full Code Here


    @SuppressWarnings({"unchecked"})
    @Override
    public ServiceInstance<T> deserialize(byte[] bytes) throws Exception
    {
        ServiceInstance rawServiceInstance = mapper.readValue(bytes, type);
        payloadClass.cast(rawServiceInstance.getPayload()); // just to verify that it's the correct type
        return (ServiceInstance<T>)rawServiceInstance;
    }
View Full Code Here

TOP

Related Classes of org.apache.curator.x.discovery.ServiceInstance

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.