Class 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 Detail

      • AbstractInstanceConfig

        protected AbstractInstanceConfig()
      • AbstractInstanceConfig

        protected AbstractInstanceConfig​(DataCenterInfo info)
    • Method Detail

      • 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. :( public API typos are the worst. I think this was meant to be "OnInit".
        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 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.
      • 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.
      • shouldBroadcastPublicIpv4Addr

        public boolean shouldBroadcastPublicIpv4Addr()