michael@0: /* michael@0: * ==================================================================== michael@0: * michael@0: * Licensed to the Apache Software Foundation (ASF) under one or more michael@0: * contributor license agreements. See the NOTICE file distributed with michael@0: * this work for additional information regarding copyright ownership. michael@0: * The ASF licenses this file to You under the Apache License, Version 2.0 michael@0: * (the "License"); you may not use this file except in compliance with michael@0: * the License. You may obtain a copy of the License at michael@0: * michael@0: * http://www.apache.org/licenses/LICENSE-2.0 michael@0: * michael@0: * Unless required by applicable law or agreed to in writing, software michael@0: * distributed under the License is distributed on an "AS IS" BASIS, michael@0: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. michael@0: * See the License for the specific language governing permissions and michael@0: * limitations under the License. michael@0: * ==================================================================== michael@0: * michael@0: * This software consists of voluntary contributions made by many michael@0: * individuals on behalf of the Apache Software Foundation. For more michael@0: * information on the Apache Software Foundation, please see michael@0: * . michael@0: * michael@0: */ michael@0: michael@0: package ch.boye.httpclientandroidlib.conn; michael@0: michael@0: import java.io.IOException; michael@0: michael@0: /** michael@0: * Interface for releasing a connection. This can be implemented by various michael@0: * "trigger" objects which are associated with a connection, for example michael@0: * a {@link EofSensorInputStream stream} or an {@link BasicManagedEntity entity} michael@0: * or the {@link ManagedClientConnection connection} itself. michael@0: *

michael@0: * The methods in this interface can safely be called multiple times. michael@0: * The first invocation releases the connection, subsequent calls michael@0: * are ignored. michael@0: * michael@0: * @since 4.0 michael@0: */ michael@0: public interface ConnectionReleaseTrigger { michael@0: michael@0: /** michael@0: * Releases the connection with the option of keep-alive. This is a michael@0: * "graceful" release and may cause IO operations for consuming the michael@0: * remainder of a response entity. Use michael@0: * {@link #abortConnection abortConnection} for a hard release. The michael@0: * connection may be reused as specified by the duration. michael@0: * michael@0: * @throws IOException michael@0: * in case of an IO problem. The connection will be released michael@0: * anyway. michael@0: */ michael@0: void releaseConnection() michael@0: throws IOException; michael@0: michael@0: /** michael@0: * Releases the connection without the option of keep-alive. michael@0: * This is a "hard" release that implies a shutdown of the connection. michael@0: * Use {@link #releaseConnection()} for a graceful release. michael@0: * michael@0: * @throws IOException in case of an IO problem. michael@0: * The connection will be released anyway. michael@0: */ michael@0: void abortConnection() michael@0: throws IOException; michael@0: michael@0: }