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

com.firefly.reactive.adapter.http.ReactiveHTTPClientSingleton Maven / Gradle / Ivy

There is a newer version: 5.0.0-dev6
Show newest version
package com.firefly.reactive.adapter.http;

import com.firefly.utils.lang.AbstractLifeCycle;

/**
 * @author Pengtao Qiu
 */
public class ReactiveHTTPClientSingleton extends AbstractLifeCycle {
    private static ReactiveHTTPClientSingleton ourInstance = new ReactiveHTTPClientSingleton();

    public static ReactiveHTTPClientSingleton getInstance() {
        return ourInstance;
    }

    private ReactiveHTTPClient httpClient;

    private ReactiveHTTPClientSingleton() {
        start();
    }

    public ReactiveHTTPClient httpClient() {
        return httpClient;
    }

    @Override
    protected void init() {
        httpClient = new ReactiveHTTPClient();
    }

    @Override
    protected void destroy() {
        if (httpClient != null) {
            httpClient.stop();
            httpClient = null;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy