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

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

package io.dropwizard.discovery.manage;

import static com.google.common.base.Preconditions.checkNotNull;
import io.dropwizard.discovery.core.CuratorAdvertiser;
import io.dropwizard.lifecycle.Managed;
import javax.annotation.Nonnull;

public class CuratorAdvertiserManager implements Managed {

    private final CuratorAdvertiser advertiser;

    /**
     * Constructor
     * 
     * @param advertiser
     *            {@link CuratorAdvertiser}
     */
    public CuratorAdvertiserManager(
            @Nonnull final CuratorAdvertiser advertiser) {
        this.advertiser = checkNotNull(advertiser);
    }

    @Override
    public void start() throws Exception {
        // the {@link CuratorAdvertisementListener will register the service}
    }

    @Override
    public void stop() throws Exception {
        advertiser.unregisterAvailability();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy