Class AbstractAutoServiceRegistration<R extends Registration>
- java.lang.Object
-
- org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration<R>
-
- Type Parameters:
R
- Registration type passed to theServiceRegistry
.
- All Implemented Interfaces:
EventListener
,org.springframework.beans.factory.Aware
,AutoServiceRegistration
,org.springframework.context.ApplicationContextAware
,org.springframework.context.ApplicationListener<org.springframework.boot.web.context.WebServerInitializedEvent>
public abstract class AbstractAutoServiceRegistration<R extends Registration> extends Object implements AutoServiceRegistration, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.boot.web.context.WebServerInitializedEvent>
Lifecycle methods that may be useful and common toServiceRegistry
implementations. TODO: Document the lifecycle.- Author:
- Spencer Gibb
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractAutoServiceRegistration(ServiceRegistry<R> serviceRegistry)
Deprecated.protected
AbstractAutoServiceRegistration(ServiceRegistry<R> serviceRegistry, AutoServiceRegistrationProperties properties)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
bind(org.springframework.boot.web.context.WebServerInitializedEvent event)
Deprecated.protected void
deregister()
De-register the local service with theServiceRegistry
.protected void
deregisterManagement()
De-register the local management service with theServiceRegistry
.void
destroy()
protected String
getAppName()
Deprecated.protected abstract Object
getConfiguration()
Deprecated.protected org.springframework.context.ApplicationContext
getContext()
protected org.springframework.core.env.Environment
getEnvironment()
Deprecated.protected Integer
getManagementPort()
Deprecated.protected abstract R
getManagementRegistration()
protected String
getManagementServiceId()
Deprecated.protected String
getManagementServiceName()
Deprecated.int
getOrder()
int
getPhase()
protected AtomicInteger
getPort()
Deprecated.protected abstract R
getRegistration()
protected AtomicBoolean
getRunning()
protected ServiceRegistry<R>
getServiceRegistry()
boolean
isAutoStartup()
protected abstract boolean
isEnabled()
boolean
isRunning()
void
onApplicationEvent(org.springframework.boot.web.context.WebServerInitializedEvent event)
protected void
register()
Register the local service with theServiceRegistry
.protected void
registerManagement()
Register the local management service with theServiceRegistry
.void
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
protected boolean
shouldRegisterManagement()
void
start()
void
stop()
-
-
-
Constructor Detail
-
AbstractAutoServiceRegistration
@Deprecated protected AbstractAutoServiceRegistration(ServiceRegistry<R> serviceRegistry)
Deprecated.
-
AbstractAutoServiceRegistration
protected AbstractAutoServiceRegistration(ServiceRegistry<R> serviceRegistry, AutoServiceRegistrationProperties properties)
-
-
Method Detail
-
getContext
protected org.springframework.context.ApplicationContext getContext()
-
onApplicationEvent
public void onApplicationEvent(org.springframework.boot.web.context.WebServerInitializedEvent event)
- Specified by:
onApplicationEvent
in interfaceorg.springframework.context.ApplicationListener<R extends Registration>
-
bind
@Deprecated public void bind(org.springframework.boot.web.context.WebServerInitializedEvent event)
Deprecated.
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
- Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-
getEnvironment
@Deprecated protected org.springframework.core.env.Environment getEnvironment()
Deprecated.
-
getPort
@Deprecated protected AtomicInteger getPort()
Deprecated.
-
isAutoStartup
public boolean isAutoStartup()
-
start
public void start()
-
shouldRegisterManagement
protected boolean shouldRegisterManagement()
- Returns:
- Whether the management service should be registered with the
ServiceRegistry
.
-
getConfiguration
@Deprecated protected abstract Object getConfiguration()
Deprecated.- Returns:
- The object used to configure the registration.
-
isEnabled
protected abstract boolean isEnabled()
- Returns:
- True, if this is enabled.
-
getManagementServiceId
@Deprecated protected String getManagementServiceId()
Deprecated.- Returns:
- The serviceId of the Management Service.
-
getManagementServiceName
@Deprecated protected String getManagementServiceName()
Deprecated.- Returns:
- The service name of the Management Service.
-
getManagementPort
@Deprecated protected Integer getManagementPort()
Deprecated.- Returns:
- The management server port.
-
getAppName
@Deprecated protected String getAppName()
Deprecated.- Returns:
- The app name (currently the spring.application.name property).
-
destroy
@PreDestroy public void destroy()
-
isRunning
public boolean isRunning()
-
getRunning
protected AtomicBoolean getRunning()
-
getOrder
public int getOrder()
-
getPhase
public int getPhase()
-
getServiceRegistry
protected ServiceRegistry<R> getServiceRegistry()
-
getRegistration
protected abstract R getRegistration()
-
getManagementRegistration
protected abstract R getManagementRegistration()
-
register
protected void register()
Register the local service with theServiceRegistry
.
-
registerManagement
protected void registerManagement()
Register the local management service with theServiceRegistry
.
-
deregister
protected void deregister()
De-register the local service with theServiceRegistry
.
-
deregisterManagement
protected void deregisterManagement()
De-register the local management service with theServiceRegistry
.
-
stop
public void stop()
-
-