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()
ManagedHttpClientConnectiongetId in interface ManagedHttpClientConnectionHttpPoolEntry 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.Closeableclose in interface java.lang.AutoCloseableclose in interface org.apache.http.HttpConnectionjava.io.IOExceptionpublic void shutdown()
throws java.io.IOException
shutdown in interface org.apache.http.HttpConnectionjava.io.IOExceptionpublic boolean isOpen()
isOpen in interface org.apache.http.HttpConnectionpublic boolean isStale()
isStale in interface org.apache.http.HttpConnectionpublic void setSocketTimeout(int timeout)
setSocketTimeout in interface org.apache.http.HttpConnectionpublic int getSocketTimeout()
getSocketTimeout in interface org.apache.http.HttpConnectionpublic org.apache.http.HttpConnectionMetrics getMetrics()
getMetrics in interface org.apache.http.HttpConnectionpublic void flush()
throws java.io.IOException
flush in interface org.apache.http.HttpClientConnectionjava.io.IOExceptionpublic boolean isResponseAvailable(int timeout)
throws java.io.IOException
isResponseAvailable in interface org.apache.http.HttpClientConnectionjava.io.IOExceptionpublic void receiveResponseEntity(org.apache.http.HttpResponse response)
throws org.apache.http.HttpException,
java.io.IOException
receiveResponseEntity in interface org.apache.http.HttpClientConnectionorg.apache.http.HttpExceptionjava.io.IOExceptionpublic org.apache.http.HttpResponse receiveResponseHeader()
throws org.apache.http.HttpException,
java.io.IOException
receiveResponseHeader in interface org.apache.http.HttpClientConnectionorg.apache.http.HttpExceptionjava.io.IOExceptionpublic void sendRequestEntity(org.apache.http.HttpEntityEnclosingRequest request)
throws org.apache.http.HttpException,
java.io.IOException
sendRequestEntity in interface org.apache.http.HttpClientConnectionorg.apache.http.HttpExceptionjava.io.IOExceptionpublic void sendRequestHeader(org.apache.http.HttpRequest request)
throws org.apache.http.HttpException,
java.io.IOException
sendRequestHeader in interface org.apache.http.HttpClientConnectionorg.apache.http.HttpExceptionjava.io.IOExceptionpublic java.net.InetAddress getLocalAddress()
getLocalAddress in interface org.apache.http.HttpInetConnectionpublic int getLocalPort()
getLocalPort in interface org.apache.http.HttpInetConnectionpublic java.net.InetAddress getRemoteAddress()
getRemoteAddress in interface org.apache.http.HttpInetConnectionpublic int getRemotePort()
getRemotePort in interface org.apache.http.HttpInetConnectionpublic boolean isSecure()
ManagedClientConnectionisSecure in interface HttpRoutedConnectionisSecure in interface ManagedClientConnectiontrue if this connection is secure,
false otherwisepublic void bind(java.net.Socket socket)
throws java.io.IOException
ManagedHttpClientConnectionbind in interface ManagedHttpClientConnectionsocket - the socket to bind the connection to.java.io.IOExceptionpublic java.net.Socket getSocket()
ManagedHttpClientConnectiongetSocket in interface ManagedHttpClientConnectionpublic javax.net.ssl.SSLSession getSSLSession()
ManagedClientConnectionSSLSocket, 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 HttpRoutedConnectiongetSSLSession in interface ManagedClientConnectiongetSSLSession in interface ManagedHttpClientConnectionnull 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()
ManagedClientConnectiongetRoute in interface HttpRoutedConnectiongetRoute in interface ManagedClientConnectionnull if not connectedpublic void open(HttpRoute route, org.apache.http.protocol.HttpContext context, org.apache.http.params.HttpParams params) throws java.io.IOException
ManagedClientConnectionopen in interface ManagedClientConnectionroute - 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
ManagedClientConnectionopen.
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 ManagedClientConnectionsecure - 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
ManagedClientConnectionManagedClientConnection.tunnelTarget(boolean, org.apache.http.params.HttpParams).tunnelProxy in interface ManagedClientConnectionnext - 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
ManagedClientConnectiontunnelled
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 ManagedClientConnectioncontext - 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()
ManagedClientConnectiongetState in interface ManagedClientConnectionpublic void setState(java.lang.Object state)
ManagedClientConnectionsetState in interface ManagedClientConnectionstate - 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 ManagedClientConnectionpublic void unmarkReusable()
ManagedClientConnectionreuse 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 ManagedClientConnectionpublic boolean isMarkedReusable()
ManagedClientConnectionmarkReusable and
unmarkReusable for details.isMarkedReusable in interface ManagedClientConnectiontrue if this connection is marked as being in
a reusable communication state,
false otherwisepublic void setIdleDuration(long duration,
java.util.concurrent.TimeUnit unit)
ManagedClientConnectionsetIdleDuration in interface ManagedClientConnectionpublic void releaseConnection()
ConnectionReleaseTriggerabortConnection for a hard release. The
connection may be reused as specified by the duration.releaseConnection in interface ConnectionReleaseTriggerpublic void abortConnection()
ConnectionReleaseTriggerConnectionReleaseTrigger.releaseConnection() for a graceful release.abortConnection in interface ConnectionReleaseTrigger