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, AutoServiceRegistration, org.springframework.context.ApplicationListener<org.springframework.boot.web.server.context.WebServerInitializedEvent>
public abstract class AbstractAutoServiceRegistration<R extends Registration>
extends Object
implements AutoServiceRegistration, org.springframework.context.ApplicationListener<org.springframework.boot.web.server.context.WebServerInitializedEvent>
Lifecycle methods that may be useful and common to
ServiceRegistry
implementations.
TODO: Document the lifecycle.- Author:
- Spencer Gibb, Zen Huifer
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractAutoServiceRegistration(org.springframework.context.ApplicationContext context, ServiceRegistry<R> serviceRegistry, AutoServiceRegistrationProperties properties) protectedAbstractAutoServiceRegistration(org.springframework.context.ApplicationContext context, ServiceRegistry<R> serviceRegistry, AutoServiceRegistrationProperties properties, List<RegistrationLifecycle<R>> registrationLifecycles) protectedAbstractAutoServiceRegistration(org.springframework.context.ApplicationContext context, ServiceRegistry<R> serviceRegistry, AutoServiceRegistrationProperties properties, List<RegistrationManagementLifecycle<R>> registrationManagementLifecycles, List<RegistrationLifecycle<R>> registrationLifecycles) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRegistrationLifecycle(RegistrationLifecycle<R> registrationLifecycle) voidaddRegistrationManagementLifecycle(RegistrationManagementLifecycle<R> registrationManagementLifecycle) protected voidDe-register the local service with theServiceRegistry.protected voidDe-register the local management service with theServiceRegistry.voiddestroy()protected StringDeprecated.protected abstract ObjectDeprecated.protected org.springframework.context.ApplicationContextprotected org.springframework.core.env.EnvironmentDeprecated.protected IntegerDeprecated.protected abstract Rprotected StringDeprecated.protected StringDeprecated.intgetOrder()intgetPhase()protected AtomicIntegergetPort()Deprecated.protected abstract Rprotected AtomicBooleanprotected ServiceRegistry<R> booleanprotected abstract booleanbooleanvoidonApplicationEvent(org.springframework.boot.web.server.context.WebServerInitializedEvent event) protected voidregister()Register the local service with theServiceRegistry.protected voidRegister the local management service with theServiceRegistry.protected booleanvoidstart()voidstop()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Constructor Details
-
AbstractAutoServiceRegistration
protected AbstractAutoServiceRegistration(org.springframework.context.ApplicationContext context, ServiceRegistry<R> serviceRegistry, AutoServiceRegistrationProperties properties) -
AbstractAutoServiceRegistration
protected AbstractAutoServiceRegistration(org.springframework.context.ApplicationContext context, ServiceRegistry<R> serviceRegistry, AutoServiceRegistrationProperties properties, List<RegistrationManagementLifecycle<R>> registrationManagementLifecycles, List<RegistrationLifecycle<R>> registrationLifecycles) -
AbstractAutoServiceRegistration
protected AbstractAutoServiceRegistration(org.springframework.context.ApplicationContext context, ServiceRegistry<R> serviceRegistry, AutoServiceRegistrationProperties properties, List<RegistrationLifecycle<R>> registrationLifecycles)
-
-
Method Details
-
addRegistrationManagementLifecycle
public void addRegistrationManagementLifecycle(RegistrationManagementLifecycle<R> registrationManagementLifecycle) -
addRegistrationLifecycle
-
getContext
protected org.springframework.context.ApplicationContext getContext() -
onApplicationEvent
public void onApplicationEvent(org.springframework.boot.web.server.context.WebServerInitializedEvent event) - Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<R extends Registration>
-
getEnvironment
Deprecated. -
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.- Returns:
- The object used to configure the registration.
-
isEnabled
protected abstract boolean isEnabled()- Returns:
- True, if this is enabled.
-
getManagementServiceId
Deprecated.- Returns:
- The serviceId of the Management Service.
-
getManagementServiceName
Deprecated.- Returns:
- The service name of the Management Service.
-
getManagementPort
Deprecated.- Returns:
- The management server port.
-
getAppName
Deprecated.- Returns:
- The app name (currently the spring.application.name property).
-
destroy
@PreDestroy public void destroy() -
isRunning
public boolean isRunning() -
getRunning
-
getOrder
public int getOrder() -
getPhase
public int getPhase() -
getServiceRegistry
-
getRegistration
-
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()
-