Example usage for com.google.common.util.concurrent ServiceManager awaitStopped

List of usage examples for com.google.common.util.concurrent ServiceManager awaitStopped

Introduction

In this page you can find the example usage for com.google.common.util.concurrent ServiceManager awaitStopped.

Prototype

public void awaitStopped(long timeout, TimeUnit unit) throws TimeoutException 

Source Link

Document

Waits for the all the services to reach a terminal state for no more than the given time.

Usage

From source file:org.apache.aurora.GuavaUtils.java

/**
 * Create a new {@link ServiceManagerIface} that wraps a {@link ServiceManager}.
 *
 * @param delegate Service manager to delegate to.
 * @return A wrapper./*  ww  w . j  a va2 s  . c o m*/
 */
public static ServiceManagerIface serviceManager(final ServiceManager delegate) {
    return new ServiceManagerIface() {
        @Override
        public ServiceManagerIface startAsync() {
            delegate.startAsync();
            return this;
        }

        @Override
        public void awaitHealthy() {
            delegate.awaitHealthy();
        }

        @Override
        public ServiceManagerIface stopAsync() {
            delegate.stopAsync();
            return this;
        }

        @Override
        public void awaitStopped(long timeout, TimeUnit unit) throws TimeoutException {
            delegate.awaitStopped(timeout, unit);
        }

        @Override
        public ImmutableMultimap<State, Service> servicesByState() {
            return delegate.servicesByState();
        }
    };
}