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

io.dropwizard.client.DropwizardExecutorProvider Maven / Gradle / Ivy

There is a newer version: 5.0.0-alpha.4
Show newest version
package io.dropwizard.client;

import org.glassfish.jersey.client.ClientAsyncExecutor;
import org.glassfish.jersey.spi.ExecutorServiceProvider;

import java.util.concurrent.ExecutorService;

/**
 * An {@link ExecutorServiceProvider} implementation for use within
 * Dropwizard.
 */
@ClientAsyncExecutor
class DropwizardExecutorProvider implements ExecutorServiceProvider {

    private final ExecutorService executor;

    DropwizardExecutorProvider(ExecutorService executor) {
        this.executor = executor;
    }

    @Override
    public ExecutorService getExecutorService() {
        return this.executor;
    }

    @Override
    public void dispose(ExecutorService executorService) {
        /*
         Jersey makes copies of clients, including the executor
         This means we cannot shut down the ExecutorService here as it may be in use elsewhere
         https://github.com/dropwizard/dropwizard/issues/2218
         */
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy