PoolingHttpClientConnectionManager
.@Deprecated @ThreadSafe public class DefaultClientConnectionOperator extends Object implements ClientConnectionOperator
ClientConnectionOperator
. It uses a SchemeRegistry
to look up SchemeSocketFactory
objects.
This connection operator is multihome network aware and will attempt to retry failed connects
against all known IP addresses sequentially until the connect is successful or all known
addresses fail to respond. Please note the same
CoreConnectionPNames.CONNECTION_TIMEOUT
value will be used
for each connection attempt, so in the worst case the total elapsed time before timeout
can be CONNECTION_TIMEOUT * n
where n
is the number of IP addresses
of the given host. One can disable multihome support by overriding
the resolveHostname(String)
method and returning only one IP address for the given
host name.
The following parameters can be used to customize the behavior of this class:
Modifier and Type | Field and Description |
---|---|
protected DnsResolver |
dnsResolver
Deprecated.
the custom-configured DNS lookup mechanism.
|
protected SchemeRegistry |
schemeRegistry
Deprecated.
The scheme registry for looking up socket factories.
|
Constructor and Description |
---|
DefaultClientConnectionOperator(SchemeRegistry schemes)
Deprecated.
Creates a new client connection operator for the given scheme registry.
|
DefaultClientConnectionOperator(SchemeRegistry schemes,
DnsResolver dnsResolver)
Deprecated.
Creates a new client connection operator for the given scheme registry
and the given custom DNS lookup mechanism.
|
Modifier and Type | Method and Description |
---|---|
OperatedClientConnection |
createConnection()
Deprecated.
Creates a new connection that can be operated.
|
void |
openConnection(OperatedClientConnection conn,
HttpHost target,
InetAddress local,
HttpContext context,
HttpParams params)
Deprecated.
Opens a connection to the given target host.
|
protected void |
prepareSocket(Socket sock,
HttpContext context,
HttpParams params)
Deprecated.
Performs standard initializations on a newly created socket.
|
protected InetAddress[] |
resolveHostname(String host)
Deprecated.
Resolves the given host name to an array of corresponding IP addresses, based on the
configured name service on the provided DNS resolver.
|
void |
updateSecureConnection(OperatedClientConnection conn,
HttpHost target,
HttpContext context,
HttpParams params)
Deprecated.
Updates a connection with a layered secure connection.
|
protected final SchemeRegistry schemeRegistry
protected final DnsResolver dnsResolver
public DefaultClientConnectionOperator(SchemeRegistry schemes)
schemes
- the scheme registrypublic DefaultClientConnectionOperator(SchemeRegistry schemes, DnsResolver dnsResolver)
schemes
- the scheme registrydnsResolver
- the custom DNS lookup mechanismpublic OperatedClientConnection createConnection()
ClientConnectionOperator
createConnection
in interface ClientConnectionOperator
public void openConnection(OperatedClientConnection conn, HttpHost target, InetAddress local, HttpContext context, HttpParams params) throws IOException
ClientConnectionOperator
openConnection
in interface ClientConnectionOperator
conn
- the connection to opentarget
- the target host to connect tolocal
- the local address to route from, or
null
for the defaultcontext
- the context for the connectionparams
- the parameters for the connectionIOException
- in case of a problempublic void updateSecureConnection(OperatedClientConnection conn, HttpHost target, HttpContext context, HttpParams params) throws IOException
ClientConnectionOperator
updateSecureConnection
in interface ClientConnectionOperator
conn
- the open connection to updatetarget
- the target host for the updated connection.
The connection must already be open or tunnelled
to the host and port, but the scheme of the target
will be used to create a layered connection.context
- the context for the connectionparams
- the parameters for the updated connectionIOException
- in case of a problemprotected void prepareSocket(Socket sock, HttpContext context, HttpParams params) throws IOException
sock
- the socket to preparecontext
- the context for the connectionparams
- the parameters from which to prepare the socketIOException
- in case of an IO problemprotected InetAddress[] resolveHostname(String host) throws UnknownHostException
host
- host name to resolveUnknownHostException
- if no IP address for the host could be determined.DnsResolver
,
SystemDefaultDnsResolver
Copyright © 1999–2013 The Apache Software Foundation. All rights reserved.