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

io.dropwizard.lifecycle.JettyManaged Maven / Gradle / Ivy

The newest version!
package io.dropwizard.lifecycle;

import org.eclipse.jetty.util.component.AbstractLifeCycle;

/**
 * A wrapper for {@link Managed} instances which ties them to a Jetty {@link
 * org.eclipse.jetty.util.component.LifeCycle}.
 */
public class JettyManaged extends AbstractLifeCycle implements Managed {
    private final Managed managed;

    /**
     * Creates a new JettyManaged wrapping {@code managed}.
     *
     * @param managed a {@link Managed} instance to be wrapped
     */
    public JettyManaged(Managed managed) {
        this.managed = managed;
    }

    public Managed getManaged() {
        return managed;
    }

    @Override
    protected void doStart() throws Exception {
        managed.start();
    }

    @Override
    protected void doStop() throws Exception {
        managed.stop();
    }

    @Override
    public String toString() {
        return managed.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy