• 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/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 public interface ConnectionReleaseTrigger {
57 
58     /**
59      * Releases the connection with the option of keep-alive. This is a
60      * "graceful" release and may cause IO operations for consuming the
61      * remainder of a response entity. Use
62      * {@link #abortConnection abortConnection} for a hard release. The
63      * connection may be reused as specified by the duration.
64      *
65      * @throws IOException
66      *             in case of an IO problem. The connection will be released
67      *             anyway.
68      */
releaseConnection()69     void releaseConnection()
70         throws IOException
71         ;
72 
73     /**
74      * Releases the connection without the option of keep-alive.
75      * This is a "hard" release that implies a shutdown of the connection.
76      * Use {@link #releaseConnection releaseConnection} for a graceful release.
77      *
78      * @throws IOException      in case of an IO problem.
79      *         The connection will be released anyway.
80      */
abortConnection()81     void abortConnection()
82         throws IOException
83         ;
84 
85 
86 } // interface ConnectionReleaseTrigger
87