Code example for ThreadSafeClientConnManager

Methods: setDefaultMaxPerRoute, setMaxTotal

0
        final SchemeRegistry registry = buildSchemeRegistry();
 
        if (!connectionPooling) {
            return new SingleClientConnManager(registry);
        } else { 
            final ThreadSafeClientConnManager manager = new ThreadSafeClientConnManager(registry);
            manager.setDefaultMaxPerRoute(connectionsMaxPerRoute);
            manager.setMaxTotal(connectionsMaxTotal);
            return manager;
        } 
    } 
 
    /** 
     * Creates the default scheme registry for connection. The constructed registry supports http with a default port of 
     * 80 and https with a default port of 443. If {@link #connectionDisregardSslCertificate} is true, than the https 
     * port will accept any certificate presented by the responder. 
     *  
     * @return the default scheme registry. 
     */ 
    private SchemeRegistry buildSchemeRegistry() {
        final SchemeRegistry registry = new SchemeRegistry();