Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.MultiThreadedHttpConnectionManager


    }
    if( _baseURL.indexOf( '?' ) >=0 ) {
      throw new RuntimeException( "Invalid base url for solrj.  The base URL must not contain parameters: "+_baseURL );
    }
    _httpClient = (client == null) ? new HttpClient(new MultiThreadedHttpConnectionManager()) : client;

    if (client == null) {
      // set some better defaults if we created a new connection manager and client
     
      // increase the default connections
View Full Code Here


            throw new RepositoryException(e);
        } catch (ParserConfigurationException e) {
            throw new RepositoryException(e);
        }

        connectionManager = new MultiThreadedHttpConnectionManager();
        if (maximumHttpConnections > 0) {
            HttpConnectionManagerParams connectionParams = connectionManager.getParams();
            connectionParams.setDefaultMaxConnectionsPerHost(maximumHttpConnections);
        }
View Full Code Here

            throw new RepositoryException(e);
        } catch (ParserConfigurationException e) {
            throw new RepositoryException(e);
        }

        connectionManager = new MultiThreadedHttpConnectionManager();
        if (maximumHttpConnections > 0) {
            HttpConnectionManagerParams connectionParams = connectionManager.getParams();
            connectionParams.setDefaultMaxConnectionsPerHost(maximumHttpConnections);
            connectionParams.setMaxTotalConnections(maximumHttpConnections);
        }
View Full Code Here

        if (eprElmt == null)
            throw new IllegalArgumentException(msgs.msgPortDefinitionNotFound(serviceName, portName));
        endpointReference = EndpointFactory.convertToWSA(ODEService.createServiceRef(eprElmt));

        httpMethodConverter = new HttpMethodConverter(this.portBinding);
        connections = new MultiThreadedHttpConnectionManager();
    }
View Full Code Here

        // Prepare authorization header
        String authorization = "admin" + ":" + "admin";
        authorizationHeader = "Basic " + new String(Base64.encodeBase64(authorization.getBytes()));

        // Create an HTTP client
        HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
        connectionManager.getParams().setDefaultMaxConnectionsPerHost(10);
        connectionManager.getParams().setConnectionTimeout(60000);
        httpClient = new HttpClient(connectionManager);
    }
View Full Code Here

           
            axisClientSideService = Axis2EngineIntegration.createClientSideAxisService(definition, serviceQName, port.getName(), new Options());
   
            HttpClient httpClient = (HttpClient)configContext.getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
            if (httpClient == null) {
                MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
                HttpConnectionManagerParams connectionManagerParams = new HttpConnectionManagerParams();
                connectionManagerParams.setDefaultMaxConnectionsPerHost(2);
                connectionManagerParams.setTcpNoDelay(true);
                connectionManagerParams.setStaleCheckingEnabled(true);
                connectionManagerParams.setLinger(0);
                connectionManager.setParams(connectionManagerParams);
                httpClient = new HttpClient(connectionManager);
                configContext.setThreadPool(new ThreadPool(1, 5));
                configContext.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
                configContext.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
            }
View Full Code Here

            AxisService axisService =
                createClientSideAxisService(definition, serviceQName, port.getName(), new Options());

            HttpClient httpClient = (HttpClient)configContext.getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
            if (httpClient == null) {
                MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
                HttpConnectionManagerParams connectionManagerParams = new HttpConnectionManagerParams();
                connectionManagerParams.setDefaultMaxConnectionsPerHost(2);
                connectionManagerParams.setTcpNoDelay(true);
                connectionManagerParams.setStaleCheckingEnabled(true);
                connectionManagerParams.setLinger(0);
                connectionManager.setParams(connectionManagerParams);
                httpClient = new HttpClient(connectionManager);
                configContext.setThreadPool(new ThreadPool(1, 5));
                configContext.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
                configContext.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
            }
View Full Code Here

            this.bundleContext = ctxt.getBundleContext();
            if (configCtx != null && dataSourceInfoRepoProvided) {
                Utils.registerDeployerServices(this.bundleContext);
            }
            //TODO these params should taken frm config file OR DO we even need to set these
            httpConnectionManager = new MultiThreadedHttpConnectionManager();
            httpConnectionManager.getParams().setDefaultMaxConnectionsPerHost(2);
            httpConnectionManager.getParams().setMaxTotalConnections(20);
        } catch (Throwable t) {
            log.error("Failed to activate the BPELServiceComponent", t);
        }
View Full Code Here

public class BAMCepUtils {
   
    Log log = LogFactory.getLog(BAMCepUtils.class);
    protected synchronized void invokeSoapClient(OMElement payLoad, EndpointReference reference){
     // creates a new connection manager and a http client object
        MultiThreadedHttpConnectionManager httpConnectionManager =
                                                                   new MultiThreadedHttpConnectionManager();
        HttpClient httpClient = new HttpClient(httpConnectionManager);
        ServiceClient serviceClient=null;
        try {
            serviceClient = new ServiceClient();
            Options options = new Options();

            options.setAction("http://ws.apache.org/ws/2007/05/eventing-extended/Publish");
            options.setTo(reference);
            serviceClient.setOptions(options);
         // set the above created objects to re use.
            serviceClient.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT,
                                            Constants.VALUE_TRUE);
            serviceClient.getOptions().setProperty(HTTPConstants.CACHED_HTTP_CLIENT,
                                            httpClient);
            serviceClient.fireAndForget(payLoad);
        } catch (AxisFault axisFault) {
            axisFault.printStackTrace();
        }
        finally {
            if (serviceClient!= null) {
                try {
                    serviceClient.cleanupTransport();
                } catch (Exception e) {
                    log.error("Could not clean the transport", e);
                }

                try {
                    serviceClient.cleanup();
                } catch (Exception e) {
                    log.error("Could not clean service client", e);
                }
            }
        }
        httpConnectionManager.closeIdleConnections(0);
        httpConnectionManager.shutdown();
    }
View Full Code Here

                    threadFactory);
        }
    }

    private void initHttpConnectionManager() throws Exception {
        httpConnectionManager = new MultiThreadedHttpConnectionManager();
        // settings may be overridden from ode-axis2.properties using the same properties
        // as HttpClient
        int max_per_host = bpelServerConfiguration.getMaxConnectionsPerHost();
        int max_total = bpelServerConfiguration.getMaxTotalConnections();
        if (log.isDebugEnabled()) {
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.MultiThreadedHttpConnectionManager

Copyright © 2018 www.massapicom. 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.