BasicPooledConnAdapter.java revision 069490a5ca2fd1988d29daf45d892f47ad665115
1/*
2 * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/BasicPooledConnAdapter.java $
3 * $Revision: 653214 $
4 * $Date: 2008-05-04 07:12:13 -0700 (Sun, 04 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
31package org.apache.http.impl.conn.tsccm;
32
33
34import org.apache.http.conn.ClientConnectionManager;
35import org.apache.http.impl.conn.AbstractPoolEntry;
36import org.apache.http.impl.conn.AbstractPooledConnAdapter;
37
38
39
40/**
41 * A connection wrapper and callback handler.
42 * All connections given out by the manager are wrappers which
43 * can be {@link #detach detach}ed to prevent further use on release.
44 */
45public class BasicPooledConnAdapter extends AbstractPooledConnAdapter {
46
47    /**
48     * Creates a new adapter.
49     *
50     * @param tsccm   the connection manager
51     * @param entry   the pool entry for the connection being wrapped
52     */
53    protected BasicPooledConnAdapter(ThreadSafeClientConnManager tsccm,
54                               AbstractPoolEntry entry) {
55        super(tsccm, entry);
56        markReusable();
57    }
58
59
60    @Override
61    protected ClientConnectionManager getManager() {
62        // override needed only to make method visible in this package
63        return super.getManager();
64    }
65
66
67    /**
68     * Obtains the pool entry.
69     *
70     * @return  the pool entry, or <code>null</code> if detached
71     */
72    protected AbstractPoolEntry getPoolEntry() {
73        return super.poolEntry;
74    }
75
76
77    // non-javadoc, see base class
78    @Override
79    protected void detach() {
80        // override needed only to make method visible in this package
81        super.detach();
82    }
83}
84