public void init()

in src/main/java/com/alibaba/cloudapi/sdk/client/ApacheHttpClient.java [86:148]


    public void init(final HttpClientBuilderParams params) {
        SocketConfig socketConfig = SocketConfig.custom().setTcpNoDelay(true).setSoKeepAlive(true).setSoReuseAddress(true)
                .setSoTimeout((int)params.getReadTimeout()).build();


        Registry<ConnectionSocketFactory> registry = getRegistry();

        if(params.getRegistry() != null){
            registry = params.getRegistry();
        }

        connectionManager = new PoolingHttpClientConnectionManager(registry);
        connectionManager.setDefaultConnectionConfig(ConnectionConfig.custom().build());
        connectionManager.setDefaultSocketConfig(socketConfig);
        connectionManager.setMaxTotal(params.getDispatchMaxRequests());
        connectionManager.setDefaultMaxPerRoute(params.getDispatchMaxRequestsPerHost());

        requestRetryHandler = params.getRequestRetryHandler();
        if(null == requestRetryHandler){
            requestRetryHandler = new HttpRequestRetryHandler() {
                @Override
                public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
                    if (executionCount > 2) {
                        return false;
                    }

                    if (exception instanceof NoHttpResponseException) {
                        return true;
                    }
                    return false;
                }
            };
        }


        RequestConfig defaultConfig = RequestConfig.custom()
                .setConnectTimeout((int)params.getConnectionTimeout())
                .setSocketTimeout((int)params.getReadTimeout())
                .setConnectionRequestTimeout((int)params.getReadTimeout())
                .build();





        httpClient = HttpClients.custom().setConnectionManager(connectionManager).setDefaultRequestConfig(defaultConfig).setRetryHandler(requestRetryHandler).build();
        ApacheIdleConnectionCleaner.registerConnectionManager(connectionManager, params.getMaxIdleTimeMillis());

        this.appKey = params.getAppKey();
        this.appSecret = params.getAppSecret();
        host = params.getHost();
        scheme = params.getScheme();


        if (params.getExecutorService() == null) {
            executorService = new ThreadPoolExecutor(0, params.getDispatchMaxRequests(), DEFAULT_THREAD_KEEP_ALIVE_TIME, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(),
                    new DeafultAsyncThreadFactory());
        } else {
            executorService = params.getExecutorService();
        }


    }