FileDocCategorySizeDatePackage
ConnManagerParams.javaAPI DocAndroid 1.5 API6099Wed May 06 22:41:10 BST 2009org.apache.http.conn.params

ConnManagerParams

public final class ConnManagerParams extends Object implements ConnManagerPNames
This class represents a collection of HTTP protocol parameters applicable to client-side {@link org.apache.http.conn.ClientConnectionManager connection managers}.
author
Oleg Kalnichevski
author
Michael Becke
version
$Revision: 658785 $
since
4.0
see
ConnManagerPNames

Fields Summary
public static final int
DEFAULT_MAX_TOTAL_CONNECTIONS
The default maximum number of connections allowed overall
private static final ConnPerRoute
DEFAULT_CONN_PER_ROUTE
The default maximum number of connections allowed per host
Constructors Summary
Methods Summary
public static org.apache.http.conn.params.ConnPerRoutegetMaxConnectionsPerRoute(org.apache.http.params.HttpParams params)
Returns lookup interface for maximum number of connections allowed per route.

param
params HTTP parameters
return
lookup interface for maximum number of connections allowed per route.
see
ConnManagerPNames#MAX_CONNECTIONS_PER_ROUTE

        if (params == null) {
            throw new IllegalArgumentException
                ("HTTP parameters must not be null.");
        }
        ConnPerRoute connPerRoute = (ConnPerRoute) params.getParameter(MAX_CONNECTIONS_PER_ROUTE);
        if (connPerRoute == null) {
            connPerRoute = DEFAULT_CONN_PER_ROUTE;
        }
        return connPerRoute;
    
public static intgetMaxTotalConnections(org.apache.http.params.HttpParams params)
Gets the maximum number of connections allowed.

param
params HTTP parameters
return
The maximum number of connections allowed.
see
ConnManagerPNames#MAX_TOTAL_CONNECTIONS

        if (params == null) {
            throw new IllegalArgumentException
                ("HTTP parameters must not be null.");
        }
        return params.getIntParameter(MAX_TOTAL_CONNECTIONS, DEFAULT_MAX_TOTAL_CONNECTIONS);
    
public static longgetTimeout(org.apache.http.params.HttpParams params)
Returns the timeout in milliseconds used when retrieving a {@link org.apache.http.conn.ManagedClientConnection} from the {@link org.apache.http.conn.ClientConnectionManager}.

return
timeout in milliseconds.


                              
          
        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        return params.getLongParameter(TIMEOUT, 0);
    
public static voidsetMaxConnectionsPerRoute(org.apache.http.params.HttpParams params, org.apache.http.conn.params.ConnPerRoute connPerRoute)
Sets lookup interface for maximum number of connections allowed per route.

param
params HTTP parameters
param
connPerRoute lookup interface for maximum number of connections allowed per route
see
ConnManagerPNames#MAX_CONNECTIONS_PER_ROUTE

    
                                               
         
                                                   
        if (params == null) {
            throw new IllegalArgumentException
                ("HTTP parameters must not be null.");
        }
        params.setParameter(MAX_CONNECTIONS_PER_ROUTE, connPerRoute);
    
public static voidsetMaxTotalConnections(org.apache.http.params.HttpParams params, int maxTotalConnections)
Sets the maximum number of connections allowed.

param
params HTTP parameters
param
maxTotalConnections The maximum number of connections allowed.
see
ConnManagerPNames#MAX_TOTAL_CONNECTIONS

        if (params == null) {
            throw new IllegalArgumentException
                ("HTTP parameters must not be null.");
        }
        params.setIntParameter(MAX_TOTAL_CONNECTIONS, maxTotalConnections);
    
public static voidsetTimeout(org.apache.http.params.HttpParams params, long timeout)
Sets the timeout in milliseconds used when retrieving a {@link org.apache.http.conn.ManagedClientConnection} from the {@link org.apache.http.conn.ClientConnectionManager}.

param
timeout the timeout in milliseconds

        if (params == null) {
            throw new IllegalArgumentException("HTTP parameters may not be null");
        }
        params.setLongParameter(TIMEOUT, timeout);