Class EmbeddedEurekaBootstrap

  • All Implemented Interfaces:
    EventListener, javax.servlet.ServletContextListener

    public class EmbeddedEurekaBootstrap
    extends com.netflix.eureka.Jersey2EurekaBootStrap
    Extension of Eureka's bootstrap but with added accessors to validate internal Eureka data.
    • Field Summary

      • Fields inherited from class com.netflix.eureka.EurekaBootStrap

        awsBinder, serverContext
    • Constructor Summary

      Constructors 
      Constructor Description
      EmbeddedEurekaBootstrap​(com.netflix.discovery.DiscoveryClient client)  
    • Constructor Detail

      • EmbeddedEurekaBootstrap

        public EmbeddedEurekaBootstrap​(com.netflix.discovery.DiscoveryClient client)
    • Method Detail

      • cleanupApps

        public void cleanupApps()
        Cleans out all the registered applications inside of Eureka.
      • registeredApplications

        public List<com.netflix.discovery.shared.Application> registeredApplications()
        Returns a list of all the registered applications in Eureka.
        Returns:
        list of registered applications.
      • isApplicationRegistered

        public boolean isApplicationRegistered​(String appId)
        Checks to see if a given app is registered in Eureka.
        Parameters:
        appId - the id of the app to check.
        Returns:
        true if registered, false otherwise.
      • getRegisteredApplication

        public com.netflix.discovery.shared.Application getRegisteredApplication​(String appId)
        Returns an Application with given appId if found from Eureka.
        Parameters:
        appId - the id of the app to check.
        Returns:
        the registered application if found, otherwise null.
      • getHeartbeatCount

        public long getHeartbeatCount()
        Returns the count of heartbeat renewals in Eureka.
        Returns:
        the number of heartbeats sent to Eureka
        Implementation Note:
        This requires reflection hacks due to the way Eureka stores the renews and what is visible from this class. I don't like it, but it is what it is. The getNumOfRenewsInLastMin() method calls getCount() on the MeasuredRate which returns the value from the AtomicLong lastBucket. When renews happen, the increment happens on teh AtomicLong currentBucket field which is not publicly accessible.
      • registerApplication

        public void registerApplication​(String appName,
                                        String instanceId,
                                        String vipAddress,
                                        String status)
        Loads an application instance in Eureka for later retrieval.
        Parameters:
        appName - the application name
        instanceId - the instance id
        vipAddress - the VIP address of the instance
        status - the status of the instance