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

io.vrap.rmf.base.client.HttpClientBase Maven / Gradle / Ivy

There is a newer version: 17.17.0
Show newest version

package io.vrap.rmf.base.client;

import java.io.Closeable;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ForkJoinPool;

import io.vrap.rmf.base.client.error.BaseException;

public abstract class HttpClientBase implements VrapHttpClient, Closeable {
    private final ExecutorService executorService;

    protected HttpClientBase() {
        this(new ForkJoinPool());
    }

    protected HttpClientBase(ExecutorService executorService) {
        this.executorService = executorService;
    }

    @Override
    public final void close() {
        try {
            executorService.shutdown();
            closeDelegate();
        }
        catch (final Throwable e) {
            throw new BaseException(e);
        }
    }

    protected abstract void closeDelegate() throws Throwable;

    protected final Executor executor() {
        return executorService;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy