org.apache.commons.httpclient.params

Class HttpConnectionManagerParams

Implemented Interfaces:
Cloneable, HttpParams, Serializable

public class HttpConnectionManagerParams
extends HttpConnectionParams

This class represents a collection of HTTP protocol parameters applicable to HTTP connection managers. Protocol parameters may be linked together to form a hierarchy. If a particular parameter value has not been explicitly defined in the collection itself, its value will be drawn from the parent collection of parameters.
Since:
3.0
See Also:
Serialized Form

Field Summary

static String
MAX_HOST_CONNECTIONS
Defines the maximum number of connections allowed per host configuration.
static String
MAX_TOTAL_CONNECTIONS
Defines the maximum number of connections allowed overall.

Fields inherited from class org.apache.commons.httpclient.params.HttpConnectionParams

CONNECTION_TIMEOUT, SO_LINGER, SO_RCVBUF, SO_SNDBUF, SO_TIMEOUT, STALE_CONNECTION_CHECK, TCP_NODELAY

Method Summary

int
getDefaultMaxConnectionsPerHost()
Gets the default maximum number of connections allowed for a given host config.
int
getMaxConnectionsPerHost(HostConfiguration hostConfiguration)
Gets the maximum number of connections to be used for a particular host config.
int
getMaxTotalConnections()
Gets the maximum number of connections allowed.
void
setDefaultMaxConnectionsPerHost(int maxHostConnections)
Sets the default maximum number of connections allowed for a given host config.
void
setMaxConnectionsPerHost(HostConfiguration hostConfiguration, int maxHostConnections)
Sets the maximum number of connections to be used for the given host config.
void
setMaxTotalConnections(int maxTotalConnections)
Sets the maximum number of connections allowed.

Methods inherited from class org.apache.commons.httpclient.params.HttpConnectionParams

getConnectionTimeout, getLinger, getReceiveBufferSize, getSendBufferSize, getSoTimeout, getTcpNoDelay, isStaleCheckingEnabled, setConnectionTimeout, setLinger, setReceiveBufferSize, setSendBufferSize, setSoTimeout, setStaleCheckingEnabled, setTcpNoDelay

Methods inherited from class org.apache.commons.httpclient.params.DefaultHttpParams

clear, clone, getBooleanParameter, getDefaultParams, getDefaults, getDoubleParameter, getIntParameter, getLongParameter, getParameter, isParameterFalse, isParameterSet, isParameterSetLocally, isParameterTrue, setBooleanParameter, setDefaults, setDoubleParameter, setHttpParamsFactory, setIntParameter, setLongParameter, setParameter, setParameters

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

MAX_HOST_CONNECTIONS

public static final String MAX_HOST_CONNECTIONS
Defines the maximum number of connections allowed per host configuration. These values only apply to the number of connections from a particular instance of HttpConnectionManager.

This parameter expects a value of type Map. The value should map instances of HostConfiguration to integers. The default value can be specified using HostConfiguration.ANY_HOST_CONFIGURATION.

Field Value:
"http.connection-manager.max-per-host"
Usages and Demos :

View More Examples of HttpConnectionManagerParams.MAX_HOST_CONNECTIONS
   1:         HttpConnectionManagerParams params = connectionManager.getParams();
   2:         params.setIntParameter( HttpConnectionManagerParams.MAX_HOST_CONNECTIONS, 2 );
   3:         params.setIntParameter( HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, 4 );
   4: 
   5:         List retrievers = new ArrayList();

View Full Code Here

MAX_TOTAL_CONNECTIONS

public static final String MAX_TOTAL_CONNECTIONS
Defines the maximum number of connections allowed overall. This value only applies to the number of connections from a particular instance of HttpConnectionManager.

This parameter expects a value of type Integer.

Field Value:
"http.connection-manager.max-total"
Usages and Demos :

View More Examples of HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS
   1:         params.setIntParameter( HttpConnectionManagerParams.MAX_HOST_CONNECTIONS, 2 );
   2:         params.setIntParameter( HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, 4 );
   3: 
   4:         List retrievers = new ArrayList();

View Full Code Here
   1:         mgr.getParams().setIntParameter(
   2:             HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, 1);
   3:         client.setHttpConnectionManager(mgr);
   4:         ...
   5:         connectionManager.getParams().setIntParameter(
   6:             HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, 1);
   7: 
   8:         ...
   9:         connectionManager.getParams().setIntParameter(
  10:             HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, 1);

View Full Code Here

Method Details

getDefaultMaxConnectionsPerHost

public int getDefaultMaxConnectionsPerHost()
Gets the default maximum number of connections allowed for a given host config.
Returns:
The default maximum.

getMaxConnectionsPerHost

public int getMaxConnectionsPerHost(HostConfiguration hostConfiguration)
Gets the maximum number of connections to be used for a particular host config. If the value has not been specified for the given host the default value will be returned.
Parameters:
hostConfiguration - The host config.
Returns:
The maximum number of connections to be used for the given host config.

getMaxTotalConnections

public int getMaxTotalConnections()
Gets the maximum number of connections allowed.
Returns:
The maximum number of connections allowed.

setDefaultMaxConnectionsPerHost

public void setDefaultMaxConnectionsPerHost(int maxHostConnections)
Sets the default maximum number of connections allowed for a given host config.
Parameters:
maxHostConnections - The default maximum.

setMaxConnectionsPerHost

public void setMaxConnectionsPerHost(HostConfiguration hostConfiguration,
                                     int maxHostConnections)
Sets the maximum number of connections to be used for the given host config.
Parameters:
hostConfiguration - The host config to set the maximum for. Use HostConfiguration.ANY_HOST_CONFIGURATION to configure the default value per host.
maxHostConnections - The maximum number of connections, > 0

setMaxTotalConnections

public void setMaxTotalConnections(int maxTotalConnections)
Sets the maximum number of connections allowed.
Parameters:
maxTotalConnections - The maximum number of connections allowed.