Class RegistrationLifecycleListener
java.lang.Object
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 Object
implements org.eclipse.jetty.util.component.LifeCycle.Listener, io.dropwizard.lifecycle.ServerLifecycleListener
Listener that registers and de-registers the service based on server start up and shutdown events.
Note: This class implements the ServerLifecycleListener which is part of Dropwizard to provide access once Dropwizard has finished starting
the server. This class also extends LifeCycle.Listener from Jetty (which Dropwizard uses under the covers) to provide
access when the server is starting to shut down. 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
ConstructorsConstructorDescriptionRegistrationLifecycleListener(ServiceInfo serviceInfo, RegistryService registryService) Creates a new listener with a givenServiceInfoandRegistryService.RegistrationLifecycleListener(RegistrationManager registrationManager) Creates a new listener with a givenRegistrationManager -
Method Summary
Modifier and TypeMethodDescriptionvoidlifeCycleStopping(org.eclipse.jetty.util.component.LifeCycle event) voidserverStarted(org.eclipse.jetty.server.Server server) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.component.LifeCycle.Listener
lifeCycleFailure, lifeCycleStarted, lifeCycleStarting, lifeCycleStoppedMethods inherited from interface io.dropwizard.lifecycle.ServerLifecycleListener
getAdminPort, getLocalPort, getPortDescriptorList
-
Constructor Details
-
RegistrationLifecycleListener
Creates a new listener with a givenRegistrationManager- Parameters:
registrationManager- TheRegistrationManagerto use
-
RegistrationLifecycleListener
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 Details
-
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
-