Home | History | Annotate | Download | only in conn
      1 /*
      2  * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ConnectionReleaseTrigger.java $
      3  * $Revision: 672367 $
      4  * $Date: 2008-06-27 12:49:20 -0700 (Fri, 27 Jun 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.conn;
     32 
     33 import java.io.IOException;
     34 
     35 
     36 /**
     37  * Interface for releasing a connection.
     38  * This can be implemented by various "trigger" objects which are
     39  * associated with a connection, for example
     40  * a {@link EofSensorInputStream stream}
     41  * or an {@link BasicManagedEntity entity}
     42  * or the {@link ManagedClientConnection connection} itself.
     43  * <br/>
     44  * The methods in this interface can safely be called multiple times.
     45  * The first invocation releases the connection, subsequent calls
     46  * are ignored.
     47  *
     48  * @author <a href="mailto:rolandw at apache.org">Roland Weber</a>
     49  *
     50  *
     51  * <!-- empty lines to avoid svn diff problems -->
     52  * @version $Revision: 672367 $
     53  *
     54  * @since 4.0
     55  *
     56  * @deprecated Please use {@link java.net.URL#openConnection} instead.
     57  *     Please visit <a href="http://android-developers.blogspot.com/2011/09/androids-http-clients.html">this webpage</a>
     58  *     for further details.
     59  */
     60 @Deprecated
     61 public interface ConnectionReleaseTrigger {
     62 
     63     /**
     64      * Releases the connection with the option of keep-alive. This is a
     65      * "graceful" release and may cause IO operations for consuming the
     66      * remainder of a response entity. Use
     67      * {@link #abortConnection abortConnection} for a hard release. The
     68      * connection may be reused as specified by the duration.
     69      *
     70      * @throws IOException
     71      *             in case of an IO problem. The connection will be released
     72      *             anyway.
     73      */
     74     void releaseConnection()
     75         throws IOException
     76         ;
     77 
     78     /**
     79      * Releases the connection without the option of keep-alive.
     80      * This is a "hard" release that implies a shutdown of the connection.
     81      * Use {@link #releaseConnection releaseConnection} for a graceful release.
     82      *
     83      * @throws IOException      in case of an IO problem.
     84      *         The connection will be released anyway.
     85      */
     86     void abortConnection()
     87         throws IOException
     88         ;
     89 
     90 
     91 } // interface ConnectionReleaseTrigger
     92