ManagedHttpClientConnectionFactory
.@Deprecated class ManagedClientConnectionImpl extends java.lang.Object implements ManagedClientConnection
Modifier and Type | Field and Description |
---|---|
private long |
duration
Deprecated.
|
private ClientConnectionManager |
manager
Deprecated.
|
private ClientConnectionOperator |
operator
Deprecated.
|
private HttpPoolEntry |
poolEntry
Deprecated.
|
private boolean |
reusable
Deprecated.
|
Constructor and Description |
---|
ManagedClientConnectionImpl(ClientConnectionManager manager,
ClientConnectionOperator operator,
HttpPoolEntry entry)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
abortConnection()
Deprecated.
Releases the connection without the option of keep-alive.
|
void |
bind(java.net.Socket socket)
Deprecated.
Binds this connection to the given socket.
|
void |
close()
Deprecated.
|
(package private) HttpPoolEntry |
detach()
Deprecated.
|
private OperatedClientConnection |
ensureConnection()
Deprecated.
|
private HttpPoolEntry |
ensurePoolEntry()
Deprecated.
|
void |
flush()
Deprecated.
|
java.lang.Object |
getAttribute(java.lang.String id)
Deprecated.
|
private OperatedClientConnection |
getConnection()
Deprecated.
|
java.lang.String |
getId()
Deprecated.
Returns connection ID which is expected to be unique
for the life span of the connection manager.
|
java.net.InetAddress |
getLocalAddress()
Deprecated.
|
int |
getLocalPort()
Deprecated.
|
ClientConnectionManager |
getManager()
Deprecated.
|
org.apache.http.HttpConnectionMetrics |
getMetrics()
Deprecated.
|
(package private) HttpPoolEntry |
getPoolEntry()
Deprecated.
|
java.net.InetAddress |
getRemoteAddress()
Deprecated.
|
int |
getRemotePort()
Deprecated.
|
HttpRoute |
getRoute()
Deprecated.
Obtains the current route of this connection.
|
java.net.Socket |
getSocket()
Deprecated.
Returns the underlying socket.
|
int |
getSocketTimeout()
Deprecated.
|
javax.net.ssl.SSLSession |
getSSLSession()
Deprecated.
Obtains the SSL session of the underlying connection, if any.
|
java.lang.Object |
getState()
Deprecated.
Returns the state object associated with this connection.
|
boolean |
isMarkedReusable()
Deprecated.
Indicates whether this connection is in a reusable communication state.
|
boolean |
isOpen()
Deprecated.
|
boolean |
isResponseAvailable(int timeout)
Deprecated.
|
boolean |
isSecure()
Deprecated.
Indicates whether this connection is secure.
|
boolean |
isStale()
Deprecated.
|
void |
layerProtocol(org.apache.http.protocol.HttpContext context,
org.apache.http.params.HttpParams params)
Deprecated.
Layers a new protocol on top of a
tunnelled
connection. |
void |
markReusable()
Deprecated.
Marks this connection as being in a reusable communication state.
|
void |
open(HttpRoute route,
org.apache.http.protocol.HttpContext context,
org.apache.http.params.HttpParams params)
Deprecated.
Opens this connection according to the given route.
|
void |
receiveResponseEntity(org.apache.http.HttpResponse response)
Deprecated.
|
org.apache.http.HttpResponse |
receiveResponseHeader()
Deprecated.
|
void |
releaseConnection()
Deprecated.
Releases the connection with the option of keep-alive.
|
java.lang.Object |
removeAttribute(java.lang.String id)
Deprecated.
|
void |
sendRequestEntity(org.apache.http.HttpEntityEnclosingRequest request)
Deprecated.
|
void |
sendRequestHeader(org.apache.http.HttpRequest request)
Deprecated.
|
void |
setAttribute(java.lang.String id,
java.lang.Object obj)
Deprecated.
|
void |
setIdleDuration(long duration,
java.util.concurrent.TimeUnit unit)
Deprecated.
Sets the duration that this connection can remain idle before it is
reused.
|
void |
setSocketTimeout(int timeout)
Deprecated.
|
void |
setState(java.lang.Object state)
Deprecated.
Assigns a state object to this connection.
|
void |
shutdown()
Deprecated.
|
void |
tunnelProxy(org.apache.http.HttpHost next,
boolean secure,
org.apache.http.params.HttpParams params)
Deprecated.
Indicates that a tunnel to an intermediate proxy has been established.
|
void |
tunnelTarget(boolean secure,
org.apache.http.params.HttpParams params)
Deprecated.
Indicates that a tunnel to the target has been established.
|
void |
unmarkReusable()
Deprecated.
Marks this connection as not being in a reusable state.
|
private final ClientConnectionManager manager
private final ClientConnectionOperator operator
private volatile HttpPoolEntry poolEntry
private volatile boolean reusable
private volatile long duration
ManagedClientConnectionImpl(ClientConnectionManager manager, ClientConnectionOperator operator, HttpPoolEntry entry)
public java.lang.String getId()
ManagedHttpClientConnection
getId
in interface ManagedHttpClientConnection
HttpPoolEntry getPoolEntry()
HttpPoolEntry detach()
public ClientConnectionManager getManager()
private OperatedClientConnection getConnection()
private OperatedClientConnection ensureConnection()
private HttpPoolEntry ensurePoolEntry()
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface org.apache.http.HttpConnection
java.io.IOException
public void shutdown() throws java.io.IOException
shutdown
in interface org.apache.http.HttpConnection
java.io.IOException
public boolean isOpen()
isOpen
in interface org.apache.http.HttpConnection
public boolean isStale()
isStale
in interface org.apache.http.HttpConnection
public void setSocketTimeout(int timeout)
setSocketTimeout
in interface org.apache.http.HttpConnection
public int getSocketTimeout()
getSocketTimeout
in interface org.apache.http.HttpConnection
public org.apache.http.HttpConnectionMetrics getMetrics()
getMetrics
in interface org.apache.http.HttpConnection
public void flush() throws java.io.IOException
flush
in interface org.apache.http.HttpClientConnection
java.io.IOException
public boolean isResponseAvailable(int timeout) throws java.io.IOException
isResponseAvailable
in interface org.apache.http.HttpClientConnection
java.io.IOException
public void receiveResponseEntity(org.apache.http.HttpResponse response) throws org.apache.http.HttpException, java.io.IOException
receiveResponseEntity
in interface org.apache.http.HttpClientConnection
org.apache.http.HttpException
java.io.IOException
public org.apache.http.HttpResponse receiveResponseHeader() throws org.apache.http.HttpException, java.io.IOException
receiveResponseHeader
in interface org.apache.http.HttpClientConnection
org.apache.http.HttpException
java.io.IOException
public void sendRequestEntity(org.apache.http.HttpEntityEnclosingRequest request) throws org.apache.http.HttpException, java.io.IOException
sendRequestEntity
in interface org.apache.http.HttpClientConnection
org.apache.http.HttpException
java.io.IOException
public void sendRequestHeader(org.apache.http.HttpRequest request) throws org.apache.http.HttpException, java.io.IOException
sendRequestHeader
in interface org.apache.http.HttpClientConnection
org.apache.http.HttpException
java.io.IOException
public java.net.InetAddress getLocalAddress()
getLocalAddress
in interface org.apache.http.HttpInetConnection
public int getLocalPort()
getLocalPort
in interface org.apache.http.HttpInetConnection
public java.net.InetAddress getRemoteAddress()
getRemoteAddress
in interface org.apache.http.HttpInetConnection
public int getRemotePort()
getRemotePort
in interface org.apache.http.HttpInetConnection
public boolean isSecure()
ManagedClientConnection
isSecure
in interface HttpRoutedConnection
isSecure
in interface ManagedClientConnection
true
if this connection is secure,
false
otherwisepublic void bind(java.net.Socket socket) throws java.io.IOException
ManagedHttpClientConnection
bind
in interface ManagedHttpClientConnection
socket
- the socket to bind the connection to.java.io.IOException
public java.net.Socket getSocket()
ManagedHttpClientConnection
getSocket
in interface ManagedHttpClientConnection
public javax.net.ssl.SSLSession getSSLSession()
ManagedClientConnection
SSLSocket
, the SSL session of
that socket is obtained. This is a potentially blocking operation.
Note: Whether the underlying socket is an SSL socket
can not necessarily be determined via ManagedClientConnection.isSecure()
.
Plain sockets may be considered secure, for example if they are
connected to a known host in the same network segment.
On the other hand, SSL sockets may be considered insecure,
for example depending on the chosen cipher suite.
getSSLSession
in interface HttpRoutedConnection
getSSLSession
in interface ManagedClientConnection
getSSLSession
in interface ManagedHttpClientConnection
null
otherwisepublic java.lang.Object getAttribute(java.lang.String id)
public java.lang.Object removeAttribute(java.lang.String id)
public void setAttribute(java.lang.String id, java.lang.Object obj)
public HttpRoute getRoute()
ManagedClientConnection
getRoute
in interface HttpRoutedConnection
getRoute
in interface ManagedClientConnection
null
if not connectedpublic void open(HttpRoute route, org.apache.http.protocol.HttpContext context, org.apache.http.params.HttpParams params) throws java.io.IOException
ManagedClientConnection
open
in interface ManagedClientConnection
route
- the route along which to open. It will be opened to
the first proxy if present, or directly to the target.context
- the context for opening this connectionparams
- the parameters for opening this connectionjava.io.IOException
- in case of a problempublic void tunnelTarget(boolean secure, org.apache.http.params.HttpParams params) throws java.io.IOException
ManagedClientConnection
open
.
Subsequently, layerProtocol
can be called
to layer the TLS/SSL protocol on top of the tunnelled connection.
Note: In HttpClient 3, a call to the corresponding method would automatically trigger the layering of the TLS/SSL protocol. This is not the case anymore, you can establish a tunnel without layering a new protocol over the connection.
tunnelTarget
in interface ManagedClientConnection
secure
- true
if the tunnel should be considered
secure, false
otherwiseparams
- the parameters for tunnelling this connectionjava.io.IOException
- in case of a problempublic void tunnelProxy(org.apache.http.HttpHost next, boolean secure, org.apache.http.params.HttpParams params) throws java.io.IOException
ManagedClientConnection
ManagedClientConnection.tunnelTarget(boolean, org.apache.http.params.HttpParams)
.tunnelProxy
in interface ManagedClientConnection
next
- the proxy to which the tunnel was established.
This is not the proxy through which
the tunnel was established, but the new end point
of the tunnel. The tunnel does not yet
reach to the target, use ManagedClientConnection.tunnelTarget(boolean, org.apache.http.params.HttpParams)
to indicate an end-to-end tunnel.secure
- true
if the connection should be
considered secure, false
otherwiseparams
- the parameters for tunnelling this connectionjava.io.IOException
- in case of a problempublic void layerProtocol(org.apache.http.protocol.HttpContext context, org.apache.http.params.HttpParams params) throws java.io.IOException
ManagedClientConnection
tunnelled
connection. This is typically used to create a TLS/SSL connection
through a proxy.
The route is the one previously passed to open
.
It is not guaranteed that the layered connection is
secure
.layerProtocol
in interface ManagedClientConnection
context
- the context for layering on top of this connectionparams
- the parameters for layering on top of this connectionjava.io.IOException
- in case of a problempublic java.lang.Object getState()
ManagedClientConnection
getState
in interface ManagedClientConnection
public void setState(java.lang.Object state)
ManagedClientConnection
setState
in interface ManagedClientConnection
state
- The state objectpublic void markReusable()
ManagedClientConnection
A reusable communication state is necessary but not sufficient
for the connection to be reused.
A route
mismatch, the connection being closed,
or other circumstances might prevent reuse.
markReusable
in interface ManagedClientConnection
public void unmarkReusable()
ManagedClientConnection
reuse strategy
.
Note:
It is not necessary to call here before writing to
or reading from this connection. Communication attempts will
automatically unmark the state as non-reusable. It can then
be switched back using markReusable
.
unmarkReusable
in interface ManagedClientConnection
public boolean isMarkedReusable()
ManagedClientConnection
markReusable
and
unmarkReusable
for details.isMarkedReusable
in interface ManagedClientConnection
true
if this connection is marked as being in
a reusable communication state,
false
otherwisepublic void setIdleDuration(long duration, java.util.concurrent.TimeUnit unit)
ManagedClientConnection
setIdleDuration
in interface ManagedClientConnection
public void releaseConnection()
ConnectionReleaseTrigger
abortConnection
for a hard release. The
connection may be reused as specified by the duration.releaseConnection
in interface ConnectionReleaseTrigger
public void abortConnection()
ConnectionReleaseTrigger
ConnectionReleaseTrigger.releaseConnection()
for a graceful release.abortConnection
in interface ConnectionReleaseTrigger