All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.dropwizard.discovery.manage.ServiceDiscoveryManager Maven / Gradle / Ivy

package io.dropwizard.discovery.manage;

import static com.google.common.base.Preconditions.checkNotNull;
import io.dropwizard.lifecycle.Managed;
import javax.annotation.Nonnull;
import org.apache.curator.x.discovery.ServiceDiscovery;

public class ServiceDiscoveryManager implements Managed {

    private final ServiceDiscovery discovery;

    /**
     * Constructor
     * 
     * @param discovery
     *            {@link ServiceDiscovery}
     */
    public ServiceDiscoveryManager(@Nonnull final ServiceDiscovery discovery) {
        this.discovery = checkNotNull(discovery);
    }

    @Override
    public void start() throws Exception {
        discovery.start();
    }

    @Override
    public void stop() throws Exception {
        discovery.close();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy