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

com.gooddata.sdk.service.gdc.GdcSardine Maven / Gradle / Ivy

There is a newer version: 3.11.1+api3
Show newest version
/*
 * Copyright (C) 2004-2019, GoodData(R) Corporation. All rights reserved.
 * This source code is licensed under the BSD-style license found in the
 * LICENSE.txt file in the root directory of this source tree.
 */
package com.gooddata.sdk.service.gdc;

import static com.gooddata.sdk.common.util.Validate.notNull;

import com.github.sardine.impl.SardineImpl;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.impl.client.HttpClientBuilder;

import java.io.IOException;

/**
 * This class extends SardineImpl, connections were not correctly closed by parent
 */
class GdcSardine extends SardineImpl {

    public GdcSardine(HttpClientBuilder builder) {
        super(builder);
    }

    /**
     * had to be overriden, because parent method did not close connection after execution
     */
    @Override
    protected  T execute(HttpRequestBase request, ResponseHandler responseHandler) throws IOException {
        notNull(request,"request");
        try {
            return super.execute(request, responseHandler);
        } finally {
            request.releaseConnection();
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy