Class AbstractInstanceConfig
- java.lang.Object
-
- 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.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_NAMESPACEDeprecated.2016-08-29 useCommonConstants.DEFAULT_CONFIG_NAMESPACE
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractInstanceConfig()protectedAbstractInstanceConfig(DataCenterInfo info)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetASGName()Gets theAWS autoscaling group nameassociated with this instance.DataCenterInfogetDataCenterInfo()Returns the data center this instance is deployed.java.lang.StringgetHostName(boolean refresh)Gets the hostname associated with this instance.java.lang.StringgetIpAddress()Get the IPAdress of the instance.intgetLeaseExpirationDurationInSeconds()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.intgetLeaseRenewalIntervalInSeconds()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.intgetNonSecurePort()Get thenon-secureport on which the instance should receive traffic.intgetSecurePort()Get theSecure porton which the instance should receive traffic.booleangetSecurePortEnabled()Indicates whether thesecureport should be enabled for traffic or not.java.lang.StringgetSecureVirtualHostName()Gets the secure virtual host name defined for this instance.java.lang.StringgetVirtualHostName()Gets the virtual host name defined for this instance.booleanisInstanceEnabledOnit()Indicates whether the instance should be enabled for taking traffic as soon as it is registered with eureka.booleanisNonSecurePortEnabled()Indicates whether thenon-secureport should be enabled for traffic or not.booleanshouldBroadcastPublicIpv4Addr()-
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
getAppGroupName, getAppname, getDefaultAddressResolutionOrder, getHealthCheckUrl, getHealthCheckUrlPath, getHomePageUrl, getHomePageUrlPath, getInstanceId, getNamespace, getSecureHealthCheckUrl, getStatusPageUrl, getStatusPageUrlPath
-
-
-
-
Field Detail
-
DEFAULT_NAMESPACE
@Deprecated public static final java.lang.String DEFAULT_NAMESPACE
Deprecated.2016-08-29 useCommonConstants.DEFAULT_CONFIG_NAMESPACE- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractInstanceConfig
protected AbstractInstanceConfig()
-
AbstractInstanceConfig
protected AbstractInstanceConfig(DataCenterInfo info)
-
-
Method Detail
-
isInstanceEnabledOnit
public boolean isInstanceEnabledOnit()
Description copied from interface:EurekaInstanceConfigIndicates 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. :( public API typos are the worst. I think this was meant to be "OnInit".- Specified by:
isInstanceEnabledOnitin interfaceEurekaInstanceConfig- Returns:
- true to immediately start taking traffic, false otherwise.
-
getNonSecurePort
public int getNonSecurePort()
Description copied from interface:EurekaInstanceConfigGet thenon-secureport on which the instance should receive traffic.- Specified by:
getNonSecurePortin interfaceEurekaInstanceConfig- Returns:
- the non-secure port on which the instance should receive traffic.
-
getSecurePort
public int getSecurePort()
Description copied from interface:EurekaInstanceConfigGet theSecure porton which the instance should receive traffic.- Specified by:
getSecurePortin interfaceEurekaInstanceConfig- Returns:
- the secure port on which the instance should receive traffic.
-
isNonSecurePortEnabled
public boolean isNonSecurePortEnabled()
Description copied from interface:EurekaInstanceConfigIndicates whether thenon-secureport should be enabled for traffic or not.- Specified by:
isNonSecurePortEnabledin interfaceEurekaInstanceConfig- Returns:
- true if the
non-secureport is enabled, false otherwise.
-
getSecurePortEnabled
public boolean getSecurePortEnabled()
Description copied from interface:EurekaInstanceConfigIndicates whether thesecureport should be enabled for traffic or not.- Specified by:
getSecurePortEnabledin interfaceEurekaInstanceConfig- Returns:
- true if the
secureport is enabled, false otherwise.
-
getLeaseRenewalIntervalInSeconds
public int getLeaseRenewalIntervalInSeconds()
Description copied from interface:EurekaInstanceConfigIndicates 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 inEurekaInstanceConfig.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
HealthCheckCallbackand then decides to make itself unavailable.- Specified by:
getLeaseRenewalIntervalInSecondsin interfaceEurekaInstanceConfig- Returns:
- time in seconds
-
getLeaseExpirationDurationInSeconds
public int getLeaseExpirationDurationInSeconds()
Description copied from interface:EurekaInstanceConfigIndicates 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:
getLeaseExpirationDurationInSecondsin interfaceEurekaInstanceConfig- Returns:
- value indicating time in seconds.
-
getVirtualHostName
public java.lang.String getVirtualHostName()
Description copied from interface:EurekaInstanceConfigGets 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:
getVirtualHostNamein interfaceEurekaInstanceConfig- 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:EurekaInstanceConfigGets 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:
getSecureVirtualHostNamein interfaceEurekaInstanceConfig- 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:EurekaInstanceConfigGets theAWS autoscaling group nameassociated 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:
getASGNamein interfaceEurekaInstanceConfig- Returns:
- the autoscaling group name associated with this instance.
-
getHostName
public java.lang.String getHostName(boolean refresh)
Description copied from interface:EurekaInstanceConfigGets the hostname associated with this instance. This is the exact name that would be used by other instances to make calls.- Specified by:
getHostNamein interfaceEurekaInstanceConfig- 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:EurekaInstanceConfigGets 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:
getMetadataMapin interfaceEurekaInstanceConfig- Returns:
- Map containing application-specific metadata.
-
getDataCenterInfo
public DataCenterInfo getDataCenterInfo()
Description copied from interface:EurekaInstanceConfigReturns 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:
getDataCenterInfoin interfaceEurekaInstanceConfig- Returns:
- information that indicates which data center this instance is deployed in.
-
getIpAddress
public java.lang.String getIpAddress()
Description copied from interface:EurekaInstanceConfigGet the IPAdress of the instance. This information is for academic purposes only as the communication from other instances primarily happen using the information supplied inEurekaInstanceConfig.getHostName(boolean).- Specified by:
getIpAddressin interfaceEurekaInstanceConfig- Returns:
- the ip address of this instance.
-
shouldBroadcastPublicIpv4Addr
public boolean shouldBroadcastPublicIpv4Addr()
-
-