Tabnine Logo
NetworkAddress.getHostName
Code IndexAdd Tabnine to your IDE (free)

How to use
getHostName
method
in
com.netflix.eureka2.registry.instance.NetworkAddress

Best Java code snippets using com.netflix.eureka2.registry.instance.NetworkAddress.getHostName (Showing top 9 results out of 315)

origin: com.netflix.eureka/eureka2-core

public List<String> returnNameOrIpList(List<NetworkAddress> addresses) {
  Iterator<NetworkAddress> it = applyQuery(addresses.iterator());
  List<String> addressList = new ArrayList<>();
  while (it.hasNext()) {
    NetworkAddress address = it.next();
    addressList.add(address.getHostName() != null ? address.getHostName() : address.getIpAddress());
  }
  return addressList;
}
origin: com.netflix.eureka/eureka2-core

public String returnNameOrIp(List<NetworkAddress> addresses) {
  Iterator<NetworkAddress> it = applyQuery(addresses.iterator());
  if (it.hasNext()) {
    NetworkAddress address = it.next();
    return address.getHostName() != null ? address.getHostName() : address.getIpAddress();
  }
  return null;
}
origin: com.netflix.eureka/eureka2-karyon-admin

public static String extractHostname(InstanceInfo instanceInfo) {
  if (AwsDataCenterInfo.class.isAssignableFrom(instanceInfo.getDataCenterInfo().getClass())) {
    final AwsDataCenterInfo dataCenterInfo = (AwsDataCenterInfo) instanceInfo.getDataCenterInfo();
    return dataCenterInfo.getPublicAddress().getHostName();
  }
  return "";
}
origin: com.netflix.eureka/eureka2-testkit

@Override
public AwsDataCenterInfo next() {
  NetworkAddress publicAddress = publicAddresses.next();
  NetworkAddress privateAddress = privateAddresses.next();
  return new AwsDataCenterInfo.Builder()
      .withAwsDataCenter(template)
      .withInstanceId(String.format("id-%08d", ++instanceId))
      .withPublicHostName(publicAddress.getHostName())
      .withPublicIPv4(publicAddress.getIpAddress())
      .withPrivateHostName(privateAddress.getHostName())
      .withPrivateIPv4(privateAddress.getIpAddress())
      .build();
}
origin: com.netflix.eureka/eureka2-karyon-admin

  @Override
  public JsonElement serialize(InstanceInfo instanceInfo, Type typeOfSrc, JsonSerializationContext context) {
    JsonObject result = new JsonObject();
    if (AwsDataCenterInfo.class.isAssignableFrom(instanceInfo.getDataCenterInfo().getClass())) {
      final AwsDataCenterInfo dataCenterInfo = (AwsDataCenterInfo) instanceInfo.getDataCenterInfo();
      result.addProperty("instId", dataCenterInfo.getInstanceId());
      if(dataCenterInfo.getPublicAddress() != null) {
        result.addProperty("ip", dataCenterInfo.getPublicAddress().getIpAddress());
        result.addProperty("hostname", dataCenterInfo.getPublicAddress().getHostName());
      }
      result.addProperty("zone", dataCenterInfo.getZone());
      result.addProperty("reg", dataCenterInfo.getRegion());
    }
    result.addProperty("appId", instanceInfo.getApp());
    result.addProperty("status", instanceInfo.getStatus().name());
    result.addProperty("vip", instanceInfo.getVipAddress());
    return result;
  }
}
origin: com.netflix.eureka/eureka2-core

public InetSocketAddress returnServiceAddress(InstanceInfo instanceInfo) {
  ServiceEndpoint endpoint = returnServiceEndpoint(instanceInfo);
  if (endpoint == null) {
    return null;
  }
  String address = endpoint.getAddress().getHostName();
  if (address == null) {
    address = endpoint.getAddress().getIpAddress();
  }
  return new InetSocketAddress(address, endpoint.getServicePort().getPort());
}
origin: com.netflix.eureka/eureka2-eureka1-rest-api

  private static Observable<Void> redirectTo(InstanceInfo readServerInfo,
                        HttpServerRequest<ByteBuf> request,
                        HttpServerResponse<ByteBuf> response) {
    ServiceEndpoint serviceEndpoint = HTTP_PUBLIC_SERVICE_SELECTOR.returnServiceEndpoint(readServerInfo);
    String redirectHost = serviceEndpoint == null ? null : serviceEndpoint.getAddress().getHostName();
    if(redirectHost == null) {
      serviceEndpoint = HTTP_PRIVATE_SERVICE_SELECTOR.returnServiceEndpoint(readServerInfo);
      redirectHost = serviceEndpoint.getAddress().getIpAddress();
    }

    StringBuilder redirectBuilder = new StringBuilder("http://")
        .append(redirectHost)
        .append(':')
        .append(serviceEndpoint.getServicePort().getPort())
        .append(request.getPath());
    if (request.getQueryString() != null) {
      redirectBuilder.append('?').append(request.getQueryString());
    }


    response.getHeaders().add(Names.LOCATION, redirectBuilder.toString());
    response.setStatus(HttpResponseStatus.FOUND);
    return Observable.empty();
  }
}
origin: com.netflix.eureka/eureka2-core

public Builder withAwsDataCenter(AwsDataCenterInfo dataCenter) {
  this.region = dataCenter.getRegion();
  this.zone = dataCenter.getZone();
  this.placementGroup = dataCenter.getPlacementGroup();
  this.amiId = dataCenter.getAmiId();
  this.instanceId = dataCenter.getInstanceId();
  this.instanceType = dataCenter.getInstanceType();
  this.privateIP = dataCenter.getPrivateAddress().getIpAddress();
  this.privateHostName = dataCenter.getPrivateAddress().getHostName();
  this.publicIP = dataCenter.getPublicAddress().getIpAddress();
  this.publicHostName = dataCenter.getPublicAddress().getHostName();
  this.eth0mac = dataCenter.getEth0mac();
  this.vpcId = dataCenter.getVpcId();
  this.accountId = dataCenter.getAccountId();
  return this;
}
origin: com.netflix.eureka/eureka2-testkit

@Override
public InstanceInfo next() {
  int cidx = idx.incrementAndGet();
  String name = baseName + '_' + cidx;
  NetworkAddress publicAddress = publicAddresses.next();
  NetworkAddress privateAddress = privateAddresses.next();
  DataCenterInfo dataCenter = new AwsDataCenterInfo.Builder()
      .withAwsDataCenter(templateDataCenter)
      .withInstanceId(String.format("i-%s-%08d", baseName, cidx))
      .withPublicHostName(publicAddress.getHostName())
      .withPublicIPv4(publicAddress.getIpAddress())
      .withPrivateHostName(privateAddress.getHostName())
      .withPrivateIPv4(privateAddress.getIpAddress())
      .build();
  return new InstanceInfo.Builder()
      .withId("id#" + name)
      .withApp(template.getApp())
      .withAppGroup(template.getAppGroup())
      .withAsg(template.getAsg())
      .withHealthCheckUrls(template.getHealthCheckUrls())
      .withHomePageUrl(template.getHomePageUrl())
      .withPorts(template.getPorts())
      .withSecureVipAddress(template.getSecureVipAddress())
      .withStatus(template.getStatus())
      .withStatusPageUrl(template.getStatusPageUrl())
      .withVipAddress(template.getVipAddress())
      .withMetaData(template.getMetaData())
      .withDataCenterInfo(dataCenter)
      .build();
}
com.netflix.eureka2.registry.instanceNetworkAddressgetHostName

Popular methods of NetworkAddress

  • getIpAddress
  • <init>
  • equals
  • getLabel
  • getProtocolType
  • hasLabel
  • hashCode

Popular in Java

  • Finding current android device location
  • getResourceAsStream (ClassLoader)
  • notifyDataSetChanged (ArrayAdapter)
  • getExternalFilesDir (Context)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now