Class RegistrationLifecycleListener
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener
-
- org.kiwiproject.registry.management.dropwizard.RegistrationLifecycleListener
-
- All Implemented Interfaces:
io.dropwizard.lifecycle.ServerLifecycleListener,EventListener,org.eclipse.jetty.util.component.LifeCycle.Listener
public class RegistrationLifecycleListener extends org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener implements io.dropwizard.lifecycle.ServerLifecycleListenerListener that registers and deregisters the service based on server start up and shutdown events. Note: This class implements theServerLifecycleListenerwhich is part of Dropwizard to provide access once Dropwizard has finished starting the server. This class also extendsAbstractLifeCycle.AbstractLifeCycleListenerfrom Jetty (which Dropwizard uses under the covers) to provide access when the server is starting to shutdown. To use this class you may have to register this listener in the following ways to get both actions:var listener = new RegistrationLifecycleListener(manager); // Registers the startup with dropwizard environment.lifecycle().addServerLifecycleListener(listener); // Registers the shutdown with Jetty environment.lifecycle().addLifecycleListener(listener);
-
-
Constructor Summary
Constructors Constructor Description RegistrationLifecycleListener(ServiceInfo serviceInfo, RegistryService registryService)Creates a new listener with a givenServiceInfoandRegistryService.RegistrationLifecycleListener(RegistrationManager registrationManager)Creates a new listener with a givenRegistrationManager
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidlifeCycleStopping(org.eclipse.jetty.util.component.LifeCycle event)voidserverStarted(org.eclipse.jetty.server.Server server)-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener
lifeCycleFailure, lifeCycleStarted, lifeCycleStarting, lifeCycleStopped
-
-
-
-
Constructor Detail
-
RegistrationLifecycleListener
public RegistrationLifecycleListener(RegistrationManager registrationManager)
Creates a new listener with a givenRegistrationManager- Parameters:
registrationManager- TheRegistrationManagerto use
-
RegistrationLifecycleListener
public RegistrationLifecycleListener(ServiceInfo serviceInfo, RegistryService registryService)
Creates a new listener with a givenServiceInfoandRegistryService. This will create theRegistrationManagerthat will be used to register the service.- Parameters:
serviceInfo- theServiceInfoto use for registering the serviceregistryService- theRegistryServiceto use for sending the registration
-
-
Method Detail
-
serverStarted
public void serverStarted(org.eclipse.jetty.server.Server server)
- Specified by:
serverStartedin interfaceio.dropwizard.lifecycle.ServerLifecycleListener
-
lifeCycleStopping
public void lifeCycleStopping(org.eclipse.jetty.util.component.LifeCycle event)
- Specified by:
lifeCycleStoppingin interfaceorg.eclipse.jetty.util.component.LifeCycle.Listener- Overrides:
lifeCycleStoppingin classorg.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener
-
-