List of usage examples for org.apache.commons.httpclient MultiThreadedHttpConnectionManager MultiThreadedHttpConnectionManager
public MultiThreadedHttpConnectionManager()
From source file:org.methodize.nntprss.feed.ChannelManager.java
private ChannelManager() { // Private constructor - singleton class channelDAO = ChannelManagerDAO.getChannelManagerDAO().getChannelDAO(); hostConfig = new HostConfiguration(); httpConMgr = new MultiThreadedHttpConnectionManager(); }
From source file:org.mimacom.maven.plugins.liferay.prepare.MultithreadedDownloader.java
MultithreadedDownloader(int threads) { this.threads = threads; MultiThreadedHttpConnectionManager conMgr = new MultiThreadedHttpConnectionManager(); HostConfiguration hc = new HostConfiguration(); HttpConnectionManagerParams params = conMgr.getParams(); params.setMaxConnectionsPerHost(hc, 10); httpClient = new HttpClient(conMgr); httpClient.setHostConfiguration(hc); }
From source file:org.mskcc.cbio.portal.remote.ConnectionManager.java
/** * Gets the Global Connection Manager.//w w w . j ava2 s .c om * * @return MultiThreadedHttpConnectionManager Object. */ public static MultiThreadedHttpConnectionManager getConnectionManager() { if (connectionManager == null) { connectionManager = new MultiThreadedHttpConnectionManager(); connectionManager.getParams().setDefaultMaxConnectionsPerHost(10); connectionManager.getParams().setConnectionTimeout(5000); } return connectionManager; }
From source file:org.mule.transport.http.HttpConnector.java
@Override protected void doInitialise() throws InitialisationException { super.doInitialise(); if (clientConnectionManager == null) { clientConnectionManager = new MultiThreadedHttpConnectionManager(); String prop = System.getProperty("mule.http.disableCleanupThread"); disableCleanupThread = prop != null && prop.equals("true"); if (!disableCleanupThread) { connectionCleaner = new IdleConnectionTimeoutThread(); connectionCleaner.setName("HttpClient-connection-cleaner-" + getName()); connectionCleaner.addConnectionManager(clientConnectionManager); connectionCleaner.start();//from www . java 2s .co m } HttpConnectionManagerParams params = new HttpConnectionManagerParams(); if (getSendBufferSize() != INT_VALUE_NOT_SET) { params.setSendBufferSize(getSendBufferSize()); } if (getReceiveBufferSize() != INT_VALUE_NOT_SET) { params.setReceiveBufferSize(getReceiveBufferSize()); } if (getClientSoTimeout() != INT_VALUE_NOT_SET) { params.setSoTimeout(getClientSoTimeout()); } if (getSocketSoLinger() != INT_VALUE_NOT_SET) { params.setLinger(getSocketSoLinger()); } params.setTcpNoDelay(isSendTcpNoDelay()); params.setMaxTotalConnections(dispatchers.getMaxTotal()); params.setDefaultMaxConnectionsPerHost(dispatchers.getMaxTotal()); clientConnectionManager.setParams(params); } //connection manager must be created during initialization due that devkit requires the connection manager before start phase. //That's why it not manager only during stop/start phases and must be created also here. if (connectionManager == null) { try { connectionManager = new org.mule.transport.http.HttpConnectionManager(this, getReceiverWorkManager()); } catch (MuleException e) { throw new InitialisationException( CoreMessages.createStaticMessage("failed creating http connection manager"), this); } } }
From source file:org.netbeans.cubeon.bugzilla.api.MixedModeBugzillaClientImpl.java
/** * Creates instance of MixedMode Bugzilla client. * * @param url - Bugzilla repository URL address * @param user - Bugzilla user/*from ww w. j av a2s. com*/ * @param password - Bugzilla user's password * @throws BugzillaException - throws exception in case there are any problems during initialization * of Bugzilla client */ public MixedModeBugzillaClientImpl(String url, String user, String password) throws BugzillaException { this.url = url; config = createConfiguration(url, user, password); client = new XmlRpcClient(); XmlRpcCommonsTransportFactory factory = new XmlRpcCommonsTransportFactory(client); /** * multi-threaded connection manager - it must be used in case there will be more than one * thread that will use HttpClient */ httpClient = new HttpClient(new MultiThreadedHttpConnectionManager()); factory.setHttpClient(httpClient); client.setTransportFactory(factory); client.setConfig(config); Map params = doLogin(user, password); if (!params.containsKey("id")) { throw new BugzillaException("There is no id property in the response received from login operation!"); } userId = (Integer) params.get("id"); }
From source file:org.nuxeo.ecm.webdav.JackrabbitWebdavClientTest.java
@BeforeClass public static void setUp() { // Setup code HostConfiguration hostConfig = new HostConfiguration(); hostConfig.setHost("localhost", PORT); HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager(); HttpConnectionManagerParams params = new HttpConnectionManagerParams(); int maxHostConnections = 20; params.setMaxConnectionsPerHost(hostConfig, maxHostConnections); connectionManager.setParams(params); client = new HttpClient(connectionManager); client.setHostConfiguration(hostConfig); Credentials creds = new UsernamePasswordCredentials("userId", "pw"); client.getState().setCredentials(AuthScope.ANY, creds); }
From source file:org.nuxeo.ecm.webdav.WebDavClientTest.java
protected static HttpClient createClient(String username, String password) { HostConfiguration hostConfig = new HostConfiguration(); hostConfig.setHost("localhost", WebDavServerFeature.PORT); HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager(); HttpConnectionManagerParams params = new HttpConnectionManagerParams(); int maxHostConnections = 20; params.setMaxConnectionsPerHost(hostConfig, maxHostConnections); connectionManager.setParams(params); HttpClient httpClient = new HttpClient(connectionManager); httpClient.setHostConfiguration(hostConfig); Credentials creds = new UsernamePasswordCredentials(username, password); httpClient.getState().setCredentials(AuthScope.ANY, creds); httpClient.getParams().setAuthenticationPreemptive(true); return httpClient; }
From source file:org.obm.caldav.client.AbstractPushTest.java
private HttpClient createHttpClient() { HttpClient ret = new HttpClient(new MultiThreadedHttpConnectionManager()); HttpConnectionManagerParams mp = ret.getHttpConnectionManager().getParams(); mp.setDefaultMaxConnectionsPerHost(4); mp.setMaxTotalConnections(8);//from www. ja v a 2 s. c o m return ret; }
From source file:org.obm.caldav.obmsync.service.impl.ObmSyncProviderFactory.java
protected ObmSyncProviderFactory() { MultiThreadedHttpConnectionManager mtConMan = new MultiThreadedHttpConnectionManager(); HttpClient ret = new HttpClient(mtConMan); HttpConnectionManagerParams mp = ret.getHttpConnectionManager().getParams(); mp.setDefaultMaxConnectionsPerHost(10); mp.setMaxTotalConnections(20);/*from w w w . j av a 2 s . c o m*/ this.hc = ret; }
From source file:org.obm.service.solr.SolrClientFactoryImpl.java
private HttpClient buildHttpClient() { MultiThreadedHttpConnectionManager cnxManager = new MultiThreadedHttpConnectionManager(); cnxManager.getParams().setDefaultMaxConnectionsPerHost(10); cnxManager.getParams().setMaxTotalConnections(100); return new HttpClient(cnxManager); }