Codota Logo
NetworkAddress.getHostName
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Charset c =
  • Codota IconString charsetName;Charset.forName(charsetName)
  • Codota IconCharset.defaultCharset()
  • Codota IconContentType contentType;contentType.getCharset()
  • Smart code suggestions by Codota
}
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

  • Making http post requests using okhttp
  • setRequestProperty (URLConnection)
  • onRequestPermissionsResult (Fragment)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • URLConnection (java.net)
    The abstract class URLConnection is the superclass of all classes that represent a communications li
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • JTable (javax.swing)
  • Table (org.hibernate.mapping)
    A relational table
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now