org.apache.http.impl.conn
Class AbstractPoolEntry

java.lang.Object
  extended by org.apache.http.impl.conn.AbstractPoolEntry
Direct Known Subclasses:
SingleClientConnManager.PoolEntry

public abstract class AbstractPoolEntry
extends java.lang.Object

A pool entry for use by connection manager implementations. Pool entries work in conjunction with an adapter. The adapter is handed out to applications that obtain a connection. The pool entry stores the underlying connection and tracks the route established. The adapter delegates methods for establishing the route to it's pool entry.
If the managed connections is released or revoked, the adapter gets disconnected, but the pool entry still contains the underlying connection and the established route.

Since:
4.0
Version:
$Revision: 542193 $
Author:
Roland Weber, Michael Becke

Field Summary
protected  OperatedClientConnection connection
          The underlying connection being pooled or used.
protected  RouteTracker tracker
          The tracked route, or null before tracking starts.
 
Constructor Summary
protected AbstractPoolEntry(OperatedClientConnection occ)
          Creates a new pool entry.
 
Method Summary
 void closing()
          Tracks close or shutdown of the connection.
protected abstract  ClientConnectionOperator getOperator()
          Obtains the connection operator.
 void layerProtocol(org.apache.http.protocol.HttpContext context, org.apache.http.params.HttpParams params)
          Layers a protocol on top of an established tunnel.
 void open(HttpRoute route, org.apache.http.protocol.HttpContext context, org.apache.http.params.HttpParams params)
          Opens the underlying connection.
 void tunnelCreated(boolean secure, org.apache.http.params.HttpParams params)
          Tracks tunnelling of the connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connection

protected OperatedClientConnection connection
The underlying connection being pooled or used.


tracker

protected RouteTracker tracker
The tracked route, or null before tracking starts.

Constructor Detail

AbstractPoolEntry

protected AbstractPoolEntry(OperatedClientConnection occ)
Creates a new pool entry.

Parameters:
occ - the underlying connection for this entry
Method Detail

getOperator

protected abstract ClientConnectionOperator getOperator()
Obtains the connection operator.

Returns:
the operator for opening connections and layering protocols

open

public void open(HttpRoute route,
                 org.apache.http.protocol.HttpContext context,
                 org.apache.http.params.HttpParams params)
          throws java.io.IOException
Opens the underlying connection.

Parameters:
route - the route along which to open the connection
context - the context for opening the connection
params - the parameters for opening the connection
Throws:
java.io.IOException - in case of a problem

tunnelCreated

public void tunnelCreated(boolean secure,
                          org.apache.http.params.HttpParams params)
                   throws java.io.IOException
Tracks tunnelling of the connection. The tunnel has to be established outside by sending a CONNECT request to the proxy.

Parameters:
secure - true if the tunnel should be considered secure, false otherwise
params - the parameters for tunnelling the connection
Throws:
java.io.IOException - in case of a problem

layerProtocol

public void layerProtocol(org.apache.http.protocol.HttpContext context,
                          org.apache.http.params.HttpParams params)
                   throws java.io.IOException
Layers a protocol on top of an established tunnel.

Parameters:
context - the context for layering
params - the parameters for layering
Throws:
java.io.IOException - in case of a problem

closing

public void closing()
Tracks close or shutdown of the connection. There is no distinction between the two, the route is dropped in both cases. This method should be called regardless of whether the close or shutdown succeeds or triggers an error.



Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.