1069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project/* 2069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java $ 3069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * $Revision: 673450 $ 4069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * $Date: 2008-07-02 10:35:05 -0700 (Wed, 02 Jul 2008) $ 5069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 6069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * ==================================================================== 7069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Licensed to the Apache Software Foundation (ASF) under one 8069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * or more contributor license agreements. See the NOTICE file 9069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * distributed with this work for additional information 10069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * regarding copyright ownership. The ASF licenses this file 11069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * to you under the Apache License, Version 2.0 (the 12069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * "License"); you may not use this file except in compliance 13069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * with the License. You may obtain a copy of the License at 14069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 15069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * http://www.apache.org/licenses/LICENSE-2.0 16069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 17069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Unless required by applicable law or agreed to in writing, 18069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * software distributed under the License is distributed on an 19069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * KIND, either express or implied. See the License for the 21069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * specific language governing permissions and limitations 22069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * under the License. 23069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * ==================================================================== 24069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 25069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * This software consists of voluntary contributions made by many 26069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * individuals on behalf of the Apache Software Foundation. For more 27069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * information on the Apache Software Foundation, please see 28069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * <http://www.apache.org/>. 29069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 30069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project */ 31069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 32069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectpackage org.apache.http.impl.conn; 33069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 349921905a96d7a4528cc30edc3a919f786821eb08Jesse Wilsonimport dalvik.system.SocketTagger; 35069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectimport java.io.IOException; 36d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkeyimport java.net.Socket; 37069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectimport java.util.concurrent.TimeUnit; 38069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 39069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectimport org.apache.commons.logging.Log; 40069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectimport org.apache.commons.logging.LogFactory; 41069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectimport org.apache.http.conn.ClientConnectionManager; 42069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectimport org.apache.http.conn.ClientConnectionOperator; 43069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectimport org.apache.http.conn.ClientConnectionRequest; 44069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectimport org.apache.http.conn.ManagedClientConnection; 45069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectimport org.apache.http.conn.routing.HttpRoute; 46069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectimport org.apache.http.conn.routing.RouteTracker; 47069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectimport org.apache.http.conn.scheme.SchemeRegistry; 48069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectimport org.apache.http.params.HttpParams; 49069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 50069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 51069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project/** 52069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * A connection "manager" for a single connection. 53069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * This manager is good only for single-threaded use. 54069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Allocation <i>always</i> returns the connection immediately, 55069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * even if it has not been released after the previous allocation. 56069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * In that case, a {@link #MISUSE_MESSAGE warning} is logged 57069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * and the previously issued connection is revoked. 58069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * <p> 59069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * This class is derived from <code>SimpleHttpConnectionManager</code> 60069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * in HttpClient 3. See there for original authors. 61069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * </p> 62069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 63069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @author <a href="mailto:rolandw at apache.org">Roland Weber</a> 64069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @author <a href="mailto:becke@u.washington.edu">Michael Becke</a> 65069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 66069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 67069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * <!-- empty lines to avoid svn diff problems --> 68069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @version $Revision: 673450 $ 69069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 70069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @since 4.0 71069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project */ 72069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectpublic class SingleClientConnManager implements ClientConnectionManager { 73069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 74069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project private final Log log = LogFactory.getLog(getClass()); 75069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 76069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** The message to be logged on multiple allocation. */ 77069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project public final static String MISUSE_MESSAGE = 78069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project "Invalid use of SingleClientConnManager: connection still allocated.\n" + 79069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project "Make sure to release the connection before allocating another one."; 80069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 81069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 82069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** The schemes supported by this connection manager. */ 83069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project protected SchemeRegistry schemeRegistry; 84069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 85069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** The operator for opening and updating connections. */ 86069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project protected ClientConnectionOperator connOperator; 87069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 88069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** The one and only entry in this pool. */ 89069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project protected PoolEntry uniquePoolEntry; 90069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 91069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** The currently issued managed connection, if any. */ 92069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project protected ConnAdapter managedConn; 93069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 94069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** The time of the last connection release, or -1. */ 95069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project protected long lastReleaseTime; 96069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 97069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** The time the last released connection expires and shouldn't be reused. */ 98069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project protected long connectionExpiresTime; 99069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 100069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** Whether the connection should be shut down on release. */ 101069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project protected boolean alwaysShutDown; 102069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 103069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** Indicates whether this connection manager is shut down. */ 104069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project protected volatile boolean isShutDown; 105069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 106069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 107069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 108069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 109069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** 110069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Creates a new simple connection manager. 111069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 112069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @param params the parameters for this manager 113719e14938db79a6d98ab2bdfdaf1b7b15e1ecbddJesse Wilson * @param schreg the scheme registry 114069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project */ 115069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project public SingleClientConnManager(HttpParams params, 116069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project SchemeRegistry schreg) { 117069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 118069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (schreg == null) { 119069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project throw new IllegalArgumentException 120069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project ("Scheme registry must not be null."); 121069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 122069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project this.schemeRegistry = schreg; 123069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project this.connOperator = createConnectionOperator(schreg); 124069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project this.uniquePoolEntry = new PoolEntry(); 125069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project this.managedConn = null; 126069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project this.lastReleaseTime = -1L; 127069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project this.alwaysShutDown = false; //@@@ from params? as argument? 128069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project this.isShutDown = false; 129069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 130069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } // <constructor> 131069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 132069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 133069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project @Override 134069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project protected void finalize() throws Throwable { 135069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project shutdown(); 136069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project super.finalize(); 137069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 138069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 139069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 140069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // non-javadoc, see interface ClientConnectionManager 141069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project public SchemeRegistry getSchemeRegistry() { 142069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project return this.schemeRegistry; 143069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 144069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 145069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 146069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** 147069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Hook for creating the connection operator. 148069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * It is called by the constructor. 149069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Derived classes can override this method to change the 150069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * instantiation of the operator. 151069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * The default implementation here instantiates 152069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * {@link DefaultClientConnectionOperator DefaultClientConnectionOperator}. 153069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 154069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @param schreg the scheme registry to use, or <code>null</code> 155069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 156069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @return the connection operator to use 157069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project */ 158069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project protected ClientConnectionOperator 159069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project createConnectionOperator(SchemeRegistry schreg) { 160069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 161069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project return new DefaultClientConnectionOperator(schreg); 162069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 163069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 164069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 165069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** 166069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Asserts that this manager is not shut down. 167069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 168069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @throws IllegalStateException if this manager is shut down 169069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project */ 170069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project protected final void assertStillUp() 171069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project throws IllegalStateException { 172069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 173069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (this.isShutDown) 174069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project throw new IllegalStateException("Manager is shut down."); 175069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 176069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 177069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 178069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project public final ClientConnectionRequest requestConnection( 179069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project final HttpRoute route, 180069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project final Object state) { 181069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 182069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project return new ClientConnectionRequest() { 183069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 184069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project public void abortRequest() { 185069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // Nothing to abort, since requests are immediate. 186069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 187069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 188069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project public ManagedClientConnection getConnection( 189069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project long timeout, TimeUnit tunit) { 190069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project return SingleClientConnManager.this.getConnection( 191069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project route, state); 192069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 193069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 194069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project }; 195069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 196069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 197069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 198069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** 199069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Obtains a connection. 200069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * This method does not block. 201069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 202069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @param route where the connection should point to 203069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 204069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @return a connection that can be used to communicate 205069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * along the given route 206069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project */ 207069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project public ManagedClientConnection getConnection(HttpRoute route, Object state) { 208069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 209069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (route == null) { 210069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project throw new IllegalArgumentException("Route may not be null."); 211069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 212069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project assertStillUp(); 213069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 214069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (log.isDebugEnabled()) { 215069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project log.debug("Get connection for route " + route); 216069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 217069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 218069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (managedConn != null) 219069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project revokeConnection(); 220069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 221069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // check re-usability of the connection 222069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project boolean recreate = false; 223069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project boolean shutdown = false; 224069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 225069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // Kill the connection if it expired. 226069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project closeExpiredConnections(); 227069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 228069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (uniquePoolEntry.connection.isOpen()) { 229069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project RouteTracker tracker = uniquePoolEntry.tracker; 230069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project shutdown = (tracker == null || // can happen if method is aborted 231069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project !tracker.toRoute().equals(route)); 232069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } else { 233069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // If the connection is not open, create a new PoolEntry, 234069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // as the connection may have been marked not reusable, 235069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // due to aborts -- and the PoolEntry should not be reused 236069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // either. There's no harm in recreating an entry if 237069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // the connection is closed. 238069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project recreate = true; 239069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 240069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 241069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (shutdown) { 242069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project recreate = true; 243069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project try { 244069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project uniquePoolEntry.shutdown(); 245069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } catch (IOException iox) { 246069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project log.debug("Problem shutting down connection.", iox); 247069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 248069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 249069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 250069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (recreate) 251069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project uniquePoolEntry = new PoolEntry(); 252069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 253d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey // BEGIN android-changed 254d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey // When using a recycled Socket, we need to re-tag it with any 255d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey // updated statistics options. 256d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey try { 257d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey final Socket socket = uniquePoolEntry.connection.getSocket(); 258d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey if (socket != null) { 2599921905a96d7a4528cc30edc3a919f786821eb08Jesse Wilson SocketTagger.get().tag(socket); 260d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey } 261d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey } catch (IOException iox) { 262d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey log.debug("Problem tagging socket.", iox); 263d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey } 264d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey // END android-changed 265d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey 266069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project managedConn = new ConnAdapter(uniquePoolEntry, route); 267069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 268069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project return managedConn; 269069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 270069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 271069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 272069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // non-javadoc, see interface ClientConnectionManager 273069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project public void releaseConnection(ManagedClientConnection conn, long validDuration, TimeUnit timeUnit) { 274069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project assertStillUp(); 275069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 276069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (!(conn instanceof ConnAdapter)) { 277069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project throw new IllegalArgumentException 278069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project ("Connection class mismatch, " + 279069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project "connection not obtained from this manager."); 280069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 281069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 282069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (log.isDebugEnabled()) { 283069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project log.debug("Releasing connection " + conn); 284069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 285069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 286069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project ConnAdapter sca = (ConnAdapter) conn; 287069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (sca.poolEntry == null) 288069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project return; // already released 289069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project ClientConnectionManager manager = sca.getManager(); 290069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (manager != null && manager != this) { 291069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project throw new IllegalArgumentException 292069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project ("Connection not obtained from this manager."); 293069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 294069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 295069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project try { 296d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey // BEGIN android-changed 297d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey // When recycling a Socket, we un-tag it to avoid collecting 298d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey // statistics from future users. 299d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey final Socket socket = uniquePoolEntry.connection.getSocket(); 300d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey if (socket != null) { 3019921905a96d7a4528cc30edc3a919f786821eb08Jesse Wilson SocketTagger.get().untag(socket); 302d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey } 303d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey // END android-changed 304d83e6b1cf9330504abce1d2c8700c9b6b43cc5e8Jeff Sharkey 305069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // make sure that the response has been read completely 306069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (sca.isOpen() && (this.alwaysShutDown || 307069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project !sca.isMarkedReusable()) 308069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project ) { 309069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (log.isDebugEnabled()) { 310069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project log.debug 311069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project ("Released connection open but not reusable."); 312069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 313069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 314069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // make sure this connection will not be re-used 315069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // we might have gotten here because of a shutdown trigger 316069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // shutdown of the adapter also clears the tracked route 317069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project sca.shutdown(); 318069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 319069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } catch (IOException iox) { 320069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project //@@@ log as warning? let pass? 321069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (log.isDebugEnabled()) 322069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project log.debug("Exception shutting down released connection.", 323069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project iox); 324069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } finally { 325069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project sca.detach(); 326069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project managedConn = null; 327069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project lastReleaseTime = System.currentTimeMillis(); 328069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if(validDuration > 0) 329069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project connectionExpiresTime = timeUnit.toMillis(validDuration) + lastReleaseTime; 330069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project else 331069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project connectionExpiresTime = Long.MAX_VALUE; 332069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 333069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } // releaseConnection 334069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 335069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project public void closeExpiredConnections() { 336069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if(System.currentTimeMillis() >= connectionExpiresTime) { 337069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project closeIdleConnections(0, TimeUnit.MILLISECONDS); 338069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 339069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 340069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 341069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 342069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // non-javadoc, see interface ClientConnectionManager 343069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project public void closeIdleConnections(long idletime, TimeUnit tunit) { 344069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project assertStillUp(); 345069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 346069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // idletime can be 0 or negative, no problem there 347069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (tunit == null) { 348069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project throw new IllegalArgumentException("Time unit must not be null."); 349069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 350069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 351069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if ((managedConn == null) && uniquePoolEntry.connection.isOpen()) { 352069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project final long cutoff = 353069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project System.currentTimeMillis() - tunit.toMillis(idletime); 354069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (lastReleaseTime <= cutoff) { 355069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project try { 356069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project uniquePoolEntry.close(); 357069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } catch (IOException iox) { 358069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // ignore 359069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project log.debug("Problem closing idle connection.", iox); 360069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 361069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 362069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 363069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 364069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 365069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 366069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // non-javadoc, see interface ClientConnectionManager 367069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project public void shutdown() { 368069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 369069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project this.isShutDown = true; 370069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 371069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (managedConn != null) 372069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project managedConn.detach(); 373069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 374069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project try { 375069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (uniquePoolEntry != null) // and connection open? 376069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project uniquePoolEntry.shutdown(); 377069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } catch (IOException iox) { 378069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // ignore 379069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project log.debug("Problem while shutting down manager.", iox); 380069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } finally { 381069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project uniquePoolEntry = null; 382069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 383069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 384069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 385069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 386069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** 387069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Revokes the currently issued connection. 388069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * The adapter gets disconnected, the connection will be shut down. 389069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project */ 390069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project protected void revokeConnection() { 391069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (managedConn == null) 392069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project return; 393069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 394069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project log.warn(MISUSE_MESSAGE); 395069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 396069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project managedConn.detach(); 397069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 398069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project try { 399069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project uniquePoolEntry.shutdown(); 400069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } catch (IOException iox) { 401069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project // ignore 402069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project log.debug("Problem while shutting down connection.", iox); 403069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 404069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 405069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 406069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 407069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** 408069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * The pool entry for this connection manager. 409069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project */ 410069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project protected class PoolEntry extends AbstractPoolEntry { 411069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 412069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** 413069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Creates a new pool entry. 414069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 415069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project */ 416069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project protected PoolEntry() { 417069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project super(SingleClientConnManager.this.connOperator, null); 418069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 419069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 420069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** 421069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Closes the connection in this pool entry. 422069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project */ 423069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project protected void close() 424069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project throws IOException { 425069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 426069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project shutdownEntry(); 427069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (connection.isOpen()) 428069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project connection.close(); 429069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 430069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 431069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 432069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** 433069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Shuts down the connection in this pool entry. 434069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project */ 435069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project protected void shutdown() 436069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project throws IOException { 437069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 438069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project shutdownEntry(); 439069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project if (connection.isOpen()) 440069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project connection.shutdown(); 441069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 442069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 443069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } // class PoolEntry 444069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 445069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 446069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 447069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** 448069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * The connection adapter used by this manager. 449069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project */ 450069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project protected class ConnAdapter extends AbstractPooledConnAdapter { 451069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 452069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** 453069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Creates a new connection adapter. 454069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 455069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @param entry the pool entry for the connection being wrapped 456069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @param route the planned route for this connection 457069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project */ 458069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project protected ConnAdapter(PoolEntry entry, HttpRoute route) { 459069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project super(SingleClientConnManager.this, entry); 460069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project markReusable(); 461069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project entry.route = route; 462069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 463069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 464069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project } 465069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 466069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 467069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project} // class SingleClientConnManager 468