mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Signed-off-by: Hugo Trippaers <htrippaers@schubergphilis.com>
This commit is contained in:
parent
1169464e35
commit
c8832cd4b6
@ -39,6 +39,7 @@ import java.util.UUID;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
|
||||
import org.apache.commons.httpclient.methods.GetMethod;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@ -61,6 +62,7 @@ import com.cloud.utils.script.Script;
|
||||
public class AgentShell implements IAgentShell {
|
||||
private static final Logger s_logger = Logger.getLogger(AgentShell.class
|
||||
.getName());
|
||||
private static final MultiThreadedHttpConnectionManager s_httpClientManager = new MultiThreadedHttpConnectionManager();
|
||||
|
||||
private final Properties _properties = new Properties();
|
||||
private final Map<String, Object> _cmdLineProperties = new HashMap<String, Object>();
|
||||
@ -224,7 +226,7 @@ public class AgentShell implements IAgentShell {
|
||||
}
|
||||
|
||||
public static void wget(String url, File file) throws IOException {
|
||||
final HttpClient client = new HttpClient();
|
||||
final HttpClient client = new HttpClient(s_httpClientManager);
|
||||
final GetMethod method = new GetMethod(url);
|
||||
int response;
|
||||
response = client.executeMethod(method);
|
||||
|
||||
@ -58,6 +58,7 @@ import com.caringo.client.ScspResponse;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.methods.GetMethod;
|
||||
import org.apache.commons.httpclient.Header;
|
||||
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
|
||||
|
||||
/**
|
||||
* Creates an SCSP client to a CAStor cluster, configured in "storage.root",
|
||||
@ -65,6 +66,7 @@ import org.apache.commons.httpclient.Header;
|
||||
*/
|
||||
public class S3CAStorBucketAdapter implements S3BucketAdapter {
|
||||
protected final static Logger s_logger = Logger.getLogger(S3CAStorBucketAdapter.class);
|
||||
private static final MultiThreadedHttpConnectionManager s_httpClientManager = new MultiThreadedHttpConnectionManager();
|
||||
|
||||
private static final int HTTP_OK = 200;
|
||||
private static final int HTTP_CREATED = 201;
|
||||
@ -444,7 +446,7 @@ public class S3CAStorBucketAdapter implements S3BucketAdapter {
|
||||
@Override
|
||||
public DataHandler loadObjectRange(String mountedRoot, String bucket, String fileName, long startPos, long endPos) {
|
||||
try {
|
||||
HttpClient httpClient = new HttpClient();
|
||||
HttpClient httpClient = new HttpClient(s_httpClientManager);
|
||||
// Create a method instance.
|
||||
GetMethod method = new GetMethod(castorURL(mountedRoot, bucket, fileName));
|
||||
method.addRequestHeader("Range", "bytes=" + startPos + "-" + endPos);
|
||||
|
||||
@ -37,6 +37,7 @@ import org.apache.commons.httpclient.HttpException;
|
||||
import org.apache.commons.httpclient.HttpMethod;
|
||||
import org.apache.commons.httpclient.HttpMethodRetryHandler;
|
||||
import org.apache.commons.httpclient.HttpStatus;
|
||||
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
|
||||
import org.apache.commons.httpclient.NoHttpResponseException;
|
||||
import org.apache.commons.httpclient.UsernamePasswordCredentials;
|
||||
import org.apache.commons.httpclient.auth.AuthScope;
|
||||
@ -56,6 +57,7 @@ import com.cloud.utils.Pair;
|
||||
*/
|
||||
public class HttpTemplateDownloader implements TemplateDownloader {
|
||||
public static final Logger s_logger = Logger.getLogger(HttpTemplateDownloader.class.getName());
|
||||
private static final MultiThreadedHttpConnectionManager s_httpClientManager = new MultiThreadedHttpConnectionManager();
|
||||
|
||||
private static final int CHUNK_SIZE = 1024*1024; //1M
|
||||
private String downloadUrl;
|
||||
@ -88,7 +90,7 @@ public class HttpTemplateDownloader implements TemplateDownloader {
|
||||
this.MAX_TEMPLATE_SIZE_IN_BYTES = maxTemplateSizeInBytes;
|
||||
|
||||
this.totalBytes = 0;
|
||||
this.client = new HttpClient();
|
||||
this.client = new HttpClient(s_httpClientManager);
|
||||
|
||||
myretryhandler = new HttpMethodRetryHandler() {
|
||||
public boolean retryMethod(
|
||||
|
||||
@ -44,6 +44,7 @@ import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.HttpException;
|
||||
import org.apache.commons.httpclient.HttpMethodBase;
|
||||
import org.apache.commons.httpclient.HttpStatus;
|
||||
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
|
||||
import org.apache.commons.httpclient.NameValuePair;
|
||||
import org.apache.commons.httpclient.cookie.CookiePolicy;
|
||||
import org.apache.commons.httpclient.methods.DeleteMethod;
|
||||
@ -62,6 +63,7 @@ import com.google.gson.reflect.TypeToken;
|
||||
public class NiciraNvpApi {
|
||||
private static final Logger s_logger = Logger.getLogger(NiciraNvpApi.class);
|
||||
private final static String _protocol = "https";
|
||||
private static final MultiThreadedHttpConnectionManager s_httpClientManager = new MultiThreadedHttpConnectionManager();
|
||||
|
||||
private String _name;
|
||||
private String _host;
|
||||
@ -79,7 +81,7 @@ public class NiciraNvpApi {
|
||||
throw new NiciraNvpApiException("host, adminuser and adminpass may not be null");
|
||||
}
|
||||
|
||||
_client = new HttpClient( );
|
||||
_client = new HttpClient(s_httpClientManager);
|
||||
_client.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
|
||||
|
||||
try {
|
||||
|
||||
@ -36,6 +36,7 @@ import javax.naming.ConfigurationException;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.HttpException;
|
||||
import org.apache.commons.httpclient.methods.GetMethod;
|
||||
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
@ -54,6 +55,7 @@ import com.cloud.utils.component.ComponentLocator;
|
||||
@Local(UpgradeManager.class)
|
||||
public class UpgradeManagerImpl implements UpgradeManager {
|
||||
private final static Logger s_logger = Logger.getLogger(UpgradeManagerImpl.class);
|
||||
private static final MultiThreadedHttpConnectionManager s_httpClientManager = new MultiThreadedHttpConnectionManager();
|
||||
|
||||
String _name;
|
||||
String _minimalVersion;
|
||||
@ -92,7 +94,7 @@ public class UpgradeManagerImpl implements UpgradeManager {
|
||||
public String deployNewAgent(String url) {
|
||||
s_logger.info("Updating agent with binary from " + url);
|
||||
|
||||
final HttpClient client = new HttpClient();
|
||||
final HttpClient client = new HttpClient(s_httpClientManager);
|
||||
final GetMethod method = new GetMethod(url);
|
||||
int response;
|
||||
File file = null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user