• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
AbstractPooledConnAdapter Class Referenceabstract

Abstract adapter from pool entries to managed client connections. More...

Inheritance diagram for AbstractPooledConnAdapter:
AbstractClientConnAdapter ManagedClientConnection HttpClientConnection HttpInetConnection ConnectionReleaseTrigger HttpConnection HttpConnection SingleClientConnManager.ConnAdapter BasicPooledConnAdapter

Description

The connection in the pool entry is used to initialize the base class. In addition, methods to establish a route are delegated to the pool entry. shutdown and close will clear the tracked route in the pool entry and call the respective method of the wrapped connection.

Author
Roland Weber
Version
Revision
658775
Date
2008-05-21 10:30:45 -0700 (Wed, 21 May 2008)
Since
4.0

Notice

The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.

/*
 * Copyright (C) 2006 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Public Member Functions

HttpRoute getRoute ()
 Obtains the current route of this connection. More...
 
void open (HttpRoute route, HttpContext context, HttpParams params) throws IOException
 Opens this connection according to the given route. More...
 
void tunnelTarget (boolean secure, HttpParams params) throws IOException
 Indicates that a tunnel to the target has been established. More...
 
void tunnelProxy (HttpHost next, boolean secure, HttpParams params) throws IOException
 Indicates that a tunnel to an intermediate proxy has been established. More...
 
void layerProtocol (HttpContext context, HttpParams params) throws IOException
 Layers a new protocol on top of a tunnelled connection. More...
 
void close () throws IOException
 Closes this connection gracefully. More...
 
void shutdown () throws IOException
 Force-closes this connection. More...
 
Object getState ()
 Returns the state object associated with this connection. More...
 
void setState (final Object state)
 Assigns a state object to this connection. More...
 
- Public Member Functions inherited from AbstractClientConnAdapter
boolean isOpen ()
 Checks if this connection is open. More...
 
boolean isStale ()
 Checks whether this connection has gone down. More...
 
void setSocketTimeout (int timeout)
 Sets the socket timeout value. More...
 
int getSocketTimeout ()
 Returns the socket timeout value. More...
 
HttpConnectionMetrics getMetrics ()
 Returns a collection of connection metrcis. More...
 
void flush () throws IOException
 Writes out all pending buffered data over the open connection. More...
 
boolean isResponseAvailable (int timeout) throws IOException
 Checks if response data is available from the connection. More...
 
void receiveResponseEntity (HttpResponse response) throws HttpException, IOException
 Receives the next response entity available from this connection and attaches it to an existing HttpResponse object. More...
 
HttpResponse receiveResponseHeader () throws HttpException, IOException
 Receives the request line and headers of the next response available from this connection. More...
 
void sendRequestEntity (HttpEntityEnclosingRequest request) throws HttpException, IOException
 Sends the request entity over the connection. More...
 
void sendRequestHeader (HttpRequest request) throws HttpException, IOException
 Sends the request line and all headers over the connection. More...
 
boolean isSecure ()
 Indicates whether this connection is secure. More...
 
SSLSession getSSLSession ()
 Obtains the SSL session of the underlying connection, if any. More...
 
void markReusable ()
 Marks this connection as being in a reusable communication state. More...
 
void unmarkReusable ()
 Marks this connection as not being in a reusable state. More...
 
boolean isMarkedReusable ()
 Indicates whether this connection is in a reusable communication state. More...
 
void setIdleDuration (long duration, TimeUnit unit)
 Sets the duration that this connection can remain idle before it is reused. More...
 
void releaseConnection ()
 Releases the connection with the option of keep-alive. More...
 
void abortConnection ()
 Releases the connection without the option of keep-alive. More...
 

Protected Member Functions

 AbstractPooledConnAdapter (ClientConnectionManager manager, AbstractPoolEntry entry)
 Creates a new connection adapter. More...
 
final void assertAttached ()
 Asserts that this adapter is still attached. More...
 
void detach ()
 Detaches this adapter from the wrapped connection. More...
 
- Protected Member Functions inherited from AbstractClientConnAdapter
 AbstractClientConnAdapter (ClientConnectionManager mgr, OperatedClientConnection conn)
 Creates a new connection adapter. More...
 
final void assertNotAborted () throws InterruptedIOException
 Asserts that the connection has not been aborted. More...
 
final void assertValid (final OperatedClientConnection wrappedConn)
 Asserts that there is a wrapped connection to delegate to. More...
 

Protected Attributes

volatile AbstractPoolEntry poolEntry
 The wrapped pool entry. More...
 

Constructor & Destructor Documentation

◆ AbstractPooledConnAdapter()

Parameters
managerthe connection manager
entrythe pool entry for the connection being wrapped

Member Function Documentation

◆ assertAttached()

final void assertAttached ( )
protected
Exceptions
IllegalStateExceptionif it is detached

◆ detach()

void detach ( )
protected

This adapter becomes useless.

Reimplemented from AbstractClientConnAdapter.

Reimplemented in BasicPooledConnAdapter.

◆ getRoute()

HttpRoute getRoute ( )
Returns
the route established so far, or null if not connected

Implements ManagedClientConnection.

◆ open()

void open ( HttpRoute  route,
HttpContext  context,
HttpParams  params 
) throws IOException
Parameters
routethe route along which to open. It will be opened to the first proxy if present, or directly to the target.
contextthe context for opening this connection
paramsthe parameters for opening this connection
Exceptions
IOExceptionin case of a problem

Implements ManagedClientConnection.

◆ tunnelTarget()

void tunnelTarget ( boolean  secure,
HttpParams  params 
) throws IOException

The route is the one previously passed to 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.

Parameters
securetrue if the tunnel should be considered secure, false otherwise
paramsthe parameters for tunnelling this connection
Exceptions
IOExceptionin case of a problem

Implements ManagedClientConnection.

◆ tunnelProxy()

void tunnelProxy ( HttpHost  next,
boolean  secure,
HttpParams  params 
) throws IOException

This is used exclusively for so-called proxy chains, where a request has to pass through multiple proxies before reaching the target. In that case, all proxies but the last need to be tunnelled when establishing the connection. Tunnelling of the last proxy to the target is optional and would be indicated via tunnelTarget.

Parameters
nextthe 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 tunnelTarget to indicate an end-to-end tunnel.
securetrue if the connection should be considered secure, false otherwise
paramsthe parameters for tunnelling this connection
Exceptions
IOExceptionin case of a problem

Implements ManagedClientConnection.

◆ layerProtocol()

void layerProtocol ( HttpContext  context,
HttpParams  params 
) throws IOException

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 .

Parameters
contextthe context for layering on top of this connection
paramsthe parameters for layering on top of this connection
Exceptions
IOExceptionin case of a problem

Implements ManagedClientConnection.

◆ close()

void close ( ) throws IOException

This method will attempt to flush the transmitter's internal buffer prior to closing the underlying socket. This method MUST NOT be called from a different thread to force shutdown of the connection. Use shutdown instead.

Implements HttpConnection.

◆ shutdown()

void shutdown ( ) throws IOException

This is the only method of a connection which may be called from a different thread to terminate the connection. This method will not attempt to flush the transmitter's internal buffer prior to closing the underlying socket.

Implements HttpConnection.

◆ getState()

Object getState ( )
Returns
The state object

Implements ManagedClientConnection.

◆ setState()

void setState ( final Object  state)

Connection managers may make use of the connection state when allocating persistent connections.

Parameters
stateThe state object

Implements ManagedClientConnection.

Member Data Documentation

◆ poolEntry

volatile AbstractPoolEntry poolEntry
protected