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

com.bazaarvoice.emodb.common.dropwizard.discovery.ManagedRegistration Maven / Gradle / Ivy

There is a newer version: 6.5.190
Show newest version
package com.bazaarvoice.emodb.common.dropwizard.discovery;

import com.bazaarvoice.ostrich.ServiceEndPoint;
import com.bazaarvoice.ostrich.ServiceRegistry;
import com.google.common.base.MoreObjects;
import io.dropwizard.lifecycle.Managed;

/**
 * Dropwizard managed registration of an SOA (Ostrich) end point.
 */
public class ManagedRegistration implements Managed {
    private final ServiceRegistry _serviceRegistry;
    private final ServiceEndPoint _endPoint;

    public ManagedRegistration(ServiceRegistry serviceRegistry, ServiceEndPoint endPoint) {
        _serviceRegistry = serviceRegistry;
        _endPoint = endPoint;
    }

    @Override
    public void start() throws Exception {
        _serviceRegistry.register(_endPoint);
    }

    @Override
    public void stop() throws Exception {
        _serviceRegistry.unregister(_endPoint);
    }

    // For debugging
    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this).addValue(_endPoint).toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy