Class ApplicationInfoManager


  • @Singleton
    public class ApplicationInfoManager
    extends java.lang.Object
    The class that initializes information required for registration with Eureka Server and to be discovered by other components.

    The information required for registration is provided by the user by passing the configuration defined by the contract in EurekaInstanceConfig }.AWS clients can either use or extend CloudInstanceConfig. Other non-AWS clients can use or extend either MyDataCenterInstanceConfig or very basic AbstractInstanceConfig.

    • Method Detail

      • getInstance

        @Deprecated
        public static ApplicationInfoManager getInstance()
        Deprecated.
        please use DI instead
      • getInfo

        public InstanceInfo getInfo()
        Gets the information about this instance that is registered with eureka.
        Returns:
        information about this instance that is registered with eureka.
      • registerAppMetadata

        public void registerAppMetadata​(java.util.Map<java.lang.String,​java.lang.String> appMetadata)
        Register user-specific instance meta data. Application can send any other additional meta data that need to be accessed for other reasons.The data will be periodically sent to the eureka server. Please Note that metadata added via this method is not guaranteed to be submitted to the eureka servers upon initial registration, and may be submitted as an update at a subsequent time. If you want guaranteed metadata for initial registration, please use the mechanism described in EurekaInstanceConfig.getMetadataMap()
        Parameters:
        appMetadata - application specific meta data.
      • setInstanceStatus

        public void setInstanceStatus​(InstanceInfo.InstanceStatus status)
        Set the status of this instance. Application can use this to indicate whether it is ready to receive traffic. Setting the status here also notifies all registered listeners of a status change event.
        Parameters:
        status - Status of the instance
      • setInstanceStatus

        public void setInstanceStatus​(InstanceInfo.InstanceStatus expectedStatus,
                                      InstanceInfo.InstanceStatus updateStatus)
        Set the status of this instance only if the current status equals expected status in order to avoid concurrent modification. Application can use this to indicate whether it is ready to receive traffic. Setting the status here also notifies all registered listeners of a status change event.
        Parameters:
        expectedStatus - expected current Status of the instance
        updateStatus - Status of the instance to be set
      • unregisterStatusChangeListener

        public void unregisterStatusChangeListener​(java.lang.String listenerId)
      • refreshDataCenterInfoIfRequired

        public void refreshDataCenterInfoIfRequired()
        Refetches the hostname to check if it has changed. If it has, the entire DataCenterInfo is refetched and passed on to the eureka server on next heartbeat. see InstanceInfo.getHostName() for explanation on why the hostname is used as the default address
      • refreshLeaseInfoIfRequired

        public void refreshLeaseInfoIfRequired()