Class EurekaBootStrap

  • All Implemented Interfaces:
    jakarta.servlet.ServletContextListener, java.util.EventListener

    public abstract class EurekaBootStrap
    extends java.lang.Object
    implements jakarta.servlet.ServletContextListener
    The class that kick starts the eureka server.

    The eureka server is configured by using the configuration EurekaServerConfig specified by eureka.server.props in the classpath. The eureka client component is also initialized by using the configuration EurekaInstanceConfig specified by eureka.client.props. If the server runs in the AWS cloud, the eureka server binds it to the elastic ip as specified.

    • Constructor Detail

      • EurekaBootStrap

        public EurekaBootStrap()
        Construct a default instance of Eureka boostrap
      • EurekaBootStrap

        public EurekaBootStrap​(com.netflix.discovery.EurekaClient eurekaClient)
        Construct an instance of eureka bootstrap with the supplied eureka client
        Parameters:
        eurekaClient - the eureka client to bootstrap
    • Method Detail

      • contextInitialized

        public void contextInitialized​(jakarta.servlet.ServletContextEvent event)
        Initializes Eureka, including syncing up with other Eureka peers and publishing the registry.
        Specified by:
        contextInitialized in interface jakarta.servlet.ServletContextListener
        See Also:
        ServletContextListener.contextInitialized(jakarta.servlet.ServletContextEvent)
      • initEurekaEnvironment

        protected void initEurekaEnvironment()
                                      throws java.lang.Exception
        Users can override to initialize the environment themselves.
        Throws:
        java.lang.Exception
      • initEurekaServerContext

        protected void initEurekaServerContext()
                                        throws java.lang.Exception
        init hook for server context. Override for custom logic.
        Throws:
        java.lang.Exception
      • getDiscoveryClientOptionalArgs

        protected com.netflix.discovery.AbstractDiscoveryClientOptionalArgs<?> getDiscoveryClientOptionalArgs()
      • getTransportClientFactories

        protected abstract com.netflix.discovery.shared.transport.jersey.TransportClientFactories getTransportClientFactories()
      • contextDestroyed

        public void contextDestroyed​(jakarta.servlet.ServletContextEvent event)
        Handles Eureka cleanup, including shutting down all monitors and yielding all EIPs.
        Specified by:
        contextDestroyed in interface jakarta.servlet.ServletContextListener
        See Also:
        ServletContextListener.contextDestroyed(jakarta.servlet.ServletContextEvent)
      • destroyEurekaServerContext

        protected void destroyEurekaServerContext()
                                           throws java.lang.Exception
        Server context shutdown hook. Override for custom logic
        Throws:
        java.lang.Exception
      • destroyEurekaEnvironment

        protected void destroyEurekaEnvironment()
                                         throws java.lang.Exception
        Users can override to clean up the environment themselves.
        Throws:
        java.lang.Exception
      • isAws

        protected boolean isAws​(com.netflix.appinfo.InstanceInfo selfInstanceInfo)
      • isCloud

        protected boolean isCloud​(com.netflix.config.DeploymentContext deploymentContext)