Examples of MultiThreadedHttpConnectionManager


Examples of org.apache.commons.httpclient.MultiThreadedHttpConnectionManager

        final List<Throwable> errors = new CopyOnWriteArrayList<Throwable>();
        for (int i = 0; i < threads.length; i++) {
            threads[i] = new Thread() {
                public void run() {
                    for (int j = 0; j < nbLoops; j++)  {
                        final MultiThreadedHttpConnectionManager mgr = new MultiThreadedHttpConnectionManager();
                        final HttpClient client = new HttpClient(mgr);
                        client.getHttpConnectionManager().getParams().setDefaultMaxConnectionsPerHost(100);
                        client.getHttpConnectionManager().getParams().setMaxTotalConnections(1000);
                        for (int i = 0; i < nbDownloads; i++) {
                            try {
                                checkHtmlPage(client, new URL("http://localhost:" + forwardedPort2 + path));
                            } catch (Throwable e) {
                                errors.add(e);
                            } finally {
                                latch.countDown();
                                System.err.println("Remaining: " + latch.getCount());
                            }
                        }
                        mgr.shutdown();
                    }
                }
            };
        }
        for (int i = 0; i < threads.length; i++) {
View Full Code Here

Examples of org.apache.commons.httpclient.MultiThreadedHttpConnectionManager

        return head;
    }

    private HttpClient getClient() {
        if (httpClient == null) {
            final MultiThreadedHttpConnectionManager connManager = new MultiThreadedHttpConnectionManager();
            httpClient = new HttpClient(connManager);

            Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
                public void run() {
                    connManager.shutdown();
                }
            }));

            List authPrefs = new ArrayList(3);
            authPrefs.add(AuthPolicy.DIGEST);
View Full Code Here

Examples of org.apache.commons.httpclient.MultiThreadedHttpConnectionManager

        validateParameters(uri, parameters, "httpConnectionManager.");
        // make sure the component httpConnectionManager is take effect
        HttpConnectionManager thisHttpConnectionManager = httpConnectionManager;
        if (thisHttpConnectionManager == null) {
            // only set the params on the new created http connection manager
            thisHttpConnectionManager = new MultiThreadedHttpConnectionManager();
            thisHttpConnectionManager.setParams(connectionManagerParams);
        }
        // create the configurer to use for this endpoint (authMethods contains the used methods created by the configurer)
        final Set<AuthMethod> authMethods = new LinkedHashSet<AuthMethod>();
        HttpClientConfigurer configurer = createHttpClientConfigurer(parameters, authMethods);
View Full Code Here

Examples of org.apache.commons.httpclient.MultiThreadedHttpConnectionManager

    private static class SingleClient implements HttpClientPool
    {
        SingleClient()
        {
            client = new HttpClient();
            client.setHttpConnectionManager(new MultiThreadedHttpConnectionManager());
        }
View Full Code Here

Examples of org.apache.commons.httpclient.MultiThreadedHttpConnectionManager

   */
  public AbstractHTTPClientRequestProcessor(CRConfig config) throws CRException {
    super(config);
    this.name = config.getName();
    //LOAD ADDITIONAL CONFIG
    client = new HttpClient(new MultiThreadedHttpConnectionManager());
    this.path = (String) config.get(URL_KEY);
    if (this.path == null) {
      log.error("COULD NOT GET URL FROM CONFIG (add RP.<rpnumber>.url=<url> to config). OVERTHINK YOUR CONFIG!");
    }
    String httpVersionString = config.getString(HTTP_VERSION_KEY);
View Full Code Here

Examples of org.apache.commons.httpclient.MultiThreadedHttpConnectionManager

    public static HttpClient createConnection(String scheme, String hostname, int port, String username, String password, FileSystemOptions fileSystemOptions) throws FileSystemException
    {
        HttpClient client;
        try
        {
            client = new HttpClient(new MultiThreadedHttpConnectionManager());
            final HostConfiguration config = new HostConfiguration();
            config.setHost(hostname, port, scheme);

            if (fileSystemOptions != null)
            {
View Full Code Here

Examples of org.apache.commons.httpclient.MultiThreadedHttpConnectionManager

            valueFactory = new ValueFactoryQImpl(qValueFactory, resolver);

        } catch (URIException e) {
            throw new RepositoryException(e);
        }
        connectionManager = new MultiThreadedHttpConnectionManager();
    }
View Full Code Here

Examples of org.apache.commons.httpclient.MultiThreadedHttpConnectionManager

    public static void main(String[] args) {
       
        // Create an HttpClient with the MultiThreadedHttpConnectionManager.
        // This connection manager must be used if more than one thread will
        // be using the HttpClient.
        HttpClient httpClient = new HttpClient(new MultiThreadedHttpConnectionManager());
        // Set the default host/protocol for the methods to connect to.
        // This value will only be used if the methods are not given an absolute URI
        httpClient.getHostConfiguration().setHost("jakarta.apache.org", 80, "http");
       
        // create an array of URIs to perform GETs on
View Full Code Here

Examples of org.apache.commons.httpclient.MultiThreadedHttpConnectionManager

  /**
   * Initialize the Commons Client using the specified Abdera instance and user agent
   */
  public CommonsClient(String userAgent,Abdera abdera) {
    super(abdera);
    MultiThreadedHttpConnectionManager connManager =
      new MultiThreadedHttpConnectionManager();
    client = new HttpClient(connManager);
    client.getParams().setParameter(
      HttpClientParams.USER_AGENT,
      userAgent);
    client.getParams().setBooleanParameter(
View Full Code Here

Examples of org.apache.commons.httpclient.MultiThreadedHttpConnectionManager

                configuration.setAuthenticationService(new JAASAuthenticationService());
            }
        }
        // Create client
        if (client == null) {
            connectionManager = new MultiThreadedHttpConnectionManager();
            HttpConnectionManagerParams params = new HttpConnectionManagerParams();
            params.setDefaultMaxConnectionsPerHost(configuration.getMaxConnectionsPerHost());
            params.setMaxTotalConnections(configuration.getMaxTotalConnections());
            connectionManager.setParams(params);
            client = new HttpClient(connectionManager);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.