com.netflix.appinfo
Class AbstractInstanceConfig

java.lang.Object
  extended by com.netflix.appinfo.AbstractInstanceConfig
All Implemented Interfaces:
EurekaInstanceConfig
Direct Known Subclasses:
PropertiesInstanceConfig

public abstract class AbstractInstanceConfig
extends java.lang.Object
implements EurekaInstanceConfig

An abstract instance info configuration with some defaults to get the users started quickly.The users have to override only a few methods to register their instance with eureka server.


Constructor Summary
protected AbstractInstanceConfig()
           
protected AbstractInstanceConfig(DataCenterInfo info)
           
 
Method Summary
abstract  java.lang.String getAppname()
          Get the name of the application to be registered with eureka.
 java.lang.String getASGName()
          Gets the AWS autoscaling group name associated with this instance.
 DataCenterInfo getDataCenterInfo()
          Returns the data center this instance is deployed.
 java.lang.String getHostName(boolean refresh)
          Gets the hostname associated with this instance.
 java.lang.String getIpAddress()
          Get the IPAdress of the instance.
 int getLeaseExpirationDurationInSeconds()
          Indicates the time in seconds that the eureka server waits since it received the last heartbeat before it can remove this instance from its view and there by disallowing traffic to this instance.
 int getLeaseRenewalIntervalInSeconds()
          Indicates how often (in seconds) the eureka client needs to send heartbeats to eureka server to indicate that it is still alive.
 java.util.Map<java.lang.String,java.lang.String> getMetadataMap()
          Gets the metadata name/value pairs associated with this instance.
 int getNonSecurePort()
          Get the non-secure port on which the instance should receive traffic.
 int getSecurePort()
          Get the Secure port on which the instance should receive traffic.
 boolean getSecurePortEnabled()
          Indicates whether the secure port should be enabled for traffic or not.
 java.lang.String getSecureVirtualHostName()
          Gets the secure virtual host name defined for this instance.
 java.lang.String getVirtualHostName()
          Gets the virtual host name defined for this instance.
 boolean isInstanceEnabledOnit()
          Indicates whether the instance should be enabled for taking traffic as soon as it is registered with eureka.
 boolean isNonSecurePortEnabled()
          Indicates whether the non-secure port should be enabled for traffic or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.netflix.appinfo.EurekaInstanceConfig
getHealthCheckUrl, getHealthCheckUrlPath, getHomePageUrl, getHomePageUrlPath, getNamespace, getSecureHealthCheckUrl, getStatusPageUrl, getStatusPageUrlPath
 

Constructor Detail

AbstractInstanceConfig

protected AbstractInstanceConfig()

AbstractInstanceConfig

protected AbstractInstanceConfig(DataCenterInfo info)
Method Detail

getAppname

public abstract java.lang.String getAppname()
Description copied from interface: EurekaInstanceConfig
Get the name of the application to be registered with eureka.

Specified by:
getAppname in interface EurekaInstanceConfig
Returns:
string denoting the name.

isInstanceEnabledOnit

public boolean isInstanceEnabledOnit()
Description copied from interface: EurekaInstanceConfig
Indicates whether the instance should be enabled for taking traffic as soon as it is registered with eureka. Sometimes the application might need to do some pre-processing before it is ready to take traffic.

Specified by:
isInstanceEnabledOnit in interface EurekaInstanceConfig
Returns:
true to immediately start taking traffic, false otherwise.

getNonSecurePort

public int getNonSecurePort()
Description copied from interface: EurekaInstanceConfig
Get the non-secure port on which the instance should receive traffic.

Specified by:
getNonSecurePort in interface EurekaInstanceConfig
Returns:
the non-secure port on which the instance should receive traffic.

getSecurePort

public int getSecurePort()
Description copied from interface: EurekaInstanceConfig
Get the Secure port on which the instance should receive traffic.

Specified by:
getSecurePort in interface EurekaInstanceConfig
Returns:
the non-secure port on which the instance should receive traffic.

isNonSecurePortEnabled

public boolean isNonSecurePortEnabled()
Description copied from interface: EurekaInstanceConfig
Indicates whether the non-secure port should be enabled for traffic or not.

Specified by:
isNonSecurePortEnabled in interface EurekaInstanceConfig
Returns:
true if the non-secure port is enabled, false otherwise.

getSecurePortEnabled

public boolean getSecurePortEnabled()
Description copied from interface: EurekaInstanceConfig
Indicates whether the secure port should be enabled for traffic or not.

Specified by:
getSecurePortEnabled in interface EurekaInstanceConfig
Returns:
true if the secure port is enabled, false otherwise.

getLeaseRenewalIntervalInSeconds

public int getLeaseRenewalIntervalInSeconds()
Description copied from interface: EurekaInstanceConfig
Indicates how often (in seconds) the eureka client needs to send heartbeats to eureka server to indicate that it is still alive. If the heartbeats are not received for the period specified in EurekaInstanceConfig.getLeaseExpirationDurationInSeconds(), eureka server will remove the instance from its view, there by disallowing traffic to this instance.

Note that the instance could still not take traffic if it implements HealthCheckCallback and then decides to make itself unavailable.

Specified by:
getLeaseRenewalIntervalInSeconds in interface EurekaInstanceConfig
Returns:
time in seconds

getLeaseExpirationDurationInSeconds

public int getLeaseExpirationDurationInSeconds()
Description copied from interface: EurekaInstanceConfig
Indicates the time in seconds that the eureka server waits since it received the last heartbeat before it can remove this instance from its view and there by disallowing traffic to this instance.

Setting this value too long could mean that the traffic could be routed to the instance even though the instance is not alive. Setting this value too small could mean, the instance may be taken out of traffic because of temporary network glitches.This value to be set to atleast higher than the value specified in EurekaInstanceConfig.getLeaseRenewalIntervalInSeconds() .

Specified by:
getLeaseExpirationDurationInSeconds in interface EurekaInstanceConfig
Returns:
value indicating time in seconds.

getVirtualHostName

public java.lang.String getVirtualHostName()
Description copied from interface: EurekaInstanceConfig
Gets the virtual host name defined for this instance.

This is typically the way other instance would find this instance by using the virtual host name.Think of this as similar to the fully qualified domain name, that the users of your services will need to find this instance.

Specified by:
getVirtualHostName in interface EurekaInstanceConfig
Returns:
the string indicating the virtual host name which the clients use to call this service.

getSecureVirtualHostName

public java.lang.String getSecureVirtualHostName()
Description copied from interface: EurekaInstanceConfig
Gets the secure virtual host name defined for this instance.

This is typically the way other instance would find this instance by using the secure virtual host name.Think of this as similar to the fully qualified domain name, that the users of your services will need to find this instance.

Specified by:
getSecureVirtualHostName in interface EurekaInstanceConfig
Returns:
the string indicating the secure virtual host name which the clients use to call this service.

getASGName

public java.lang.String getASGName()
Description copied from interface: EurekaInstanceConfig
Gets the AWS autoscaling group name associated with this instance. This information is specifically used in an AWS environment to automatically put an instance out of service after the instance is launched and it has been disabled for traffic..

Specified by:
getASGName in interface EurekaInstanceConfig
Returns:
the autoscaling group name associated with this instance.

getHostName

public java.lang.String getHostName(boolean refresh)
Description copied from interface: EurekaInstanceConfig
Gets the hostname associated with this instance. This is the exact name that would be used by other instances to make calls.

Specified by:
getHostName in interface EurekaInstanceConfig
Parameters:
refresh - true if the information needs to be refetched, false otherwise.
Returns:
hostname of this instance which is identifiable by other instances for making remote calls.

getMetadataMap

public java.util.Map<java.lang.String,java.lang.String> getMetadataMap()
Description copied from interface: EurekaInstanceConfig
Gets the metadata name/value pairs associated with this instance. This information is sent to eureka server and can be used by other instances.

Specified by:
getMetadataMap in interface EurekaInstanceConfig
Returns:
Map containing application-specific metadata.

getDataCenterInfo

public DataCenterInfo getDataCenterInfo()
Description copied from interface: EurekaInstanceConfig
Returns the data center this instance is deployed. This information is used to get some AWS specific instance information if the instance is deployed in AWS.

Specified by:
getDataCenterInfo in interface EurekaInstanceConfig
Returns:
information that indicates which data center this instance is deployed in.

getIpAddress

public java.lang.String getIpAddress()
Description copied from interface: EurekaInstanceConfig
Get the IPAdress of the instance. This information is for academic purposes only as the communication from other instances primarily happen using the information supplied in EurekaInstanceConfig.getHostName(boolean).

Specified by:
getIpAddress in interface EurekaInstanceConfig
Returns:
the ip address of this instance.