Package com.netflix.eureka
Class EurekaBootStrap
- java.lang.Object
-
- com.netflix.eureka.EurekaBootStrap
-
- All Implemented Interfaces:
jakarta.servlet.ServletContextListener,java.util.EventListener
public abstract class EurekaBootStrap extends java.lang.Object implements jakarta.servlet.ServletContextListenerThe class that kick starts the eureka server.The eureka server is configured by using the configuration
EurekaServerConfigspecified by eureka.server.props in the classpath. The eureka client component is also initialized by using the configurationEurekaInstanceConfigspecified by eureka.client.props. If the server runs in the AWS cloud, the eureka server binds it to the elastic ip as specified.
-
-
Field Summary
Fields Modifier and Type Field Description protected AwsBinderawsBinderprotected EurekaServerContextserverContext
-
Constructor Summary
Constructors Constructor Description EurekaBootStrap()Construct a default instance of Eureka boostrapEurekaBootStrap(com.netflix.discovery.EurekaClient eurekaClient)Construct an instance of eureka bootstrap with the supplied eureka client
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcontextDestroyed(jakarta.servlet.ServletContextEvent event)Handles Eureka cleanup, including shutting down all monitors and yielding all EIPs.voidcontextInitialized(jakarta.servlet.ServletContextEvent event)Initializes Eureka, including syncing up with other Eureka peers and publishing the registry.protected voiddestroyEurekaEnvironment()Users can override to clean up the environment themselves.protected voiddestroyEurekaServerContext()Server context shutdown hook.protected com.netflix.discovery.AbstractDiscoveryClientOptionalArgs<?>getDiscoveryClientOptionalArgs()protected abstract EurekaServerHttpClientFactorygetEurekaServerHttpClientFactory()protected abstract PeerEurekaNodesgetPeerEurekaNodes(PeerAwareInstanceRegistry registry, EurekaServerConfig eurekaServerConfig, com.netflix.discovery.EurekaClientConfig eurekaClientConfig, ServerCodecs serverCodecs, com.netflix.appinfo.ApplicationInfoManager applicationInfoManager)protected abstract com.netflix.discovery.shared.transport.jersey.TransportClientFactoriesgetTransportClientFactories()protected voidinitEurekaEnvironment()Users can override to initialize the environment themselves.protected voidinitEurekaServerContext()init hook for server context.protected booleanisAws(com.netflix.appinfo.InstanceInfo selfInstanceInfo)protected booleanisCloud(com.netflix.config.DeploymentContext deploymentContext)
-
-
-
Field Detail
-
serverContext
protected volatile EurekaServerContext serverContext
-
awsBinder
protected volatile AwsBinder awsBinder
-
-
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:
contextInitializedin interfacejakarta.servlet.ServletContextListener- See Also:
ServletContextListener.contextInitialized(jakarta.servlet.ServletContextEvent)
-
initEurekaEnvironment
protected void initEurekaEnvironment() throws java.lang.ExceptionUsers can override to initialize the environment themselves.- Throws:
java.lang.Exception
-
initEurekaServerContext
protected void initEurekaServerContext() throws java.lang.Exceptioninit 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()
-
getEurekaServerHttpClientFactory
protected abstract EurekaServerHttpClientFactory getEurekaServerHttpClientFactory()
-
getPeerEurekaNodes
protected abstract PeerEurekaNodes getPeerEurekaNodes(PeerAwareInstanceRegistry registry, EurekaServerConfig eurekaServerConfig, com.netflix.discovery.EurekaClientConfig eurekaClientConfig, ServerCodecs serverCodecs, com.netflix.appinfo.ApplicationInfoManager applicationInfoManager)
-
contextDestroyed
public void contextDestroyed(jakarta.servlet.ServletContextEvent event)
Handles Eureka cleanup, including shutting down all monitors and yielding all EIPs.- Specified by:
contextDestroyedin interfacejakarta.servlet.ServletContextListener- See Also:
ServletContextListener.contextDestroyed(jakarta.servlet.ServletContextEvent)
-
destroyEurekaServerContext
protected void destroyEurekaServerContext() throws java.lang.ExceptionServer context shutdown hook. Override for custom logic- Throws:
java.lang.Exception
-
destroyEurekaEnvironment
protected void destroyEurekaEnvironment() throws java.lang.ExceptionUsers 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)
-
-