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

com.yammer.dropwizard.lifecycle.ExecutorServiceManager Maven / Gradle / Ivy

package com.yammer.dropwizard.lifecycle;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;

public class ExecutorServiceManager implements Managed {
    private final ExecutorService executor;
    private final long shutdownPeriod;
    private final TimeUnit unit;

    public ExecutorServiceManager(ExecutorService executor, long shutdownPeriod, TimeUnit unit) {
        this.executor = executor;
        this.shutdownPeriod = shutdownPeriod;
        this.unit = unit;
    }

    @Override
    public void start() throws Exception {
        // OK BOSS
    }

    @Override
    public void stop() throws Exception {
        executor.shutdown();
        executor.awaitTermination(shutdownPeriod, unit);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy