• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntry.java $
3  * $Revision: 652721 $
4  * $Date: 2008-05-01 17:32:20 -0700 (Thu, 01 May 2008) $
5  *
6  * ====================================================================
7  *
8  *  Licensed to the Apache Software Foundation (ASF) under one or more
9  *  contributor license agreements.  See the NOTICE file distributed with
10  *  this work for additional information regarding copyright ownership.
11  *  The ASF licenses this file to You under the Apache License, Version 2.0
12  *  (the "License"); you may not use this file except in compliance with
13  *  the License.  You may obtain a copy of the License at
14  *
15  *      http://www.apache.org/licenses/LICENSE-2.0
16  *
17  *  Unless required by applicable law or agreed to in writing, software
18  *  distributed under the License is distributed on an "AS IS" BASIS,
19  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  *  See the License for the specific language governing permissions and
21  *  limitations under the License.
22  * ====================================================================
23  *
24  * This software consists of voluntary contributions made by many
25  * individuals on behalf of the Apache Software Foundation.  For more
26  * information on the Apache Software Foundation, please see
27  * <http://www.apache.org/>.
28  *
29  */
30 
31 package org.apache.http.impl.conn.tsccm;
32 
33 
34 import java.lang.ref.ReferenceQueue;
35 
36 import org.apache.http.conn.OperatedClientConnection;
37 import org.apache.http.conn.ClientConnectionOperator;
38 import org.apache.http.conn.routing.HttpRoute;
39 import org.apache.http.impl.conn.AbstractPoolEntry;
40 
41 
42 
43 /**
44  * Basic implementation of a connection pool entry.
45  *
46  * @deprecated Please use {@link java.net.URL#openConnection} instead.
47  *     Please visit <a href="http://android-developers.blogspot.com/2011/09/androids-http-clients.html">this webpage</a>
48  *     for further details.
49  */
50 @Deprecated
51 public class BasicPoolEntry extends AbstractPoolEntry {
52 
53     /**
54      * A weak reference to <code>this</code> used to detect GC of entries.
55      * Pool entries can only be GCed when they are allocated by an application
56      * and therefore not referenced with a hard link in the manager.
57      */
58     private final BasicPoolEntryRef reference;
59 
60     /**
61      * Creates a new pool entry.
62      *
63      * @param op      the connection operator
64      * @param route   the planned route for the connection
65      * @param queue   the reference queue for tracking GC of this entry,
66      *                or <code>null</code>
67      */
BasicPoolEntry(ClientConnectionOperator op, HttpRoute route, ReferenceQueue<Object> queue)68     public BasicPoolEntry(ClientConnectionOperator op,
69                           HttpRoute route,
70                           ReferenceQueue<Object> queue) {
71         super(op, route);
72         if (route == null) {
73             throw new IllegalArgumentException("HTTP route may not be null");
74         }
75         this.reference = new BasicPoolEntryRef(this, queue);
76     }
77 
getConnection()78     protected final OperatedClientConnection getConnection() {
79         return super.connection;
80     }
81 
getPlannedRoute()82     protected final HttpRoute getPlannedRoute() {
83         return super.route;
84     }
85 
getWeakRef()86     protected final BasicPoolEntryRef getWeakRef() {
87         return this.reference;
88     }
89 
90 
91 } // class BasicPoolEntry
92 
93 
94