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

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

Introduction

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

Prototype

public void awaitHealthy() 

Source Link

Document

Waits for the ServiceManager to become #isHealthy() healthy .

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.//from  w  w  w . java  2 s .  com
 */
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();
        }
    };
}