| org.apache.http.HttpConnection
All known Subclasses: org.apache.http.mockup.HttpConnectionMockup,
HttpConnection | public interface HttpConnection (Code) | | A generic HTTP connection, useful on client and server side.
author: Oleg Kalnichevski version: $Revision: 548031 $ since: 4.0 |
Method Summary | |
public void | close() Closes this connection gracefully.
This method will attempt to flush the transmitter's
internal buffer prior to closing the underlying socket.
This method MUST NOT be called from a different thread to force
shutdown of the connection. | HttpConnectionMetrics | getMetrics() | int | getSocketTimeout() Returns the socket timeout value. | public boolean | isOpen() Checks if this connection is open. | public boolean | isStale() Checks whether this connection has gone down.
Network connections may get closed during some time of inactivity
for several reasons. | void | setSocketTimeout(int timeout) Sets the socket timeout value. | public void | shutdown() Force-closes this connection.
This is the only method of a connection which may be called
from a different thread to terminate the connection. |
close | public void close() throws IOException(Code) | | Closes this connection gracefully.
This method will attempt to flush the transmitter's
internal buffer prior to closing the underlying socket.
This method MUST NOT be called from a different thread to force
shutdown of the connection. Use
HttpConnection.shutdown shutdown instead.
|
getSocketTimeout | int getSocketTimeout()(Code) | | Returns the socket timeout value.
positive value in milliseconds if a timeout is set, 0 if timeout is disabled or -1 if timeout is undefined. |
isOpen | public boolean isOpen()(Code) | | Checks if this connection is open.
true if it is open, false if it is closed. |
isStale | public boolean isStale()(Code) | | Checks whether this connection has gone down.
Network connections may get closed during some time of inactivity
for several reasons. The next time a read is attempted on such a
connection it will throw an IOException.
This method tries to alleviate this inconvenience by trying to
find out if a connection is still usable. Implementations may do
that by attempting a read with a very small timeout. Thus this
method may block for a small amount of time before returning a result.
It is therefore an expensive operation.
true if attempts to use this connection arelikely to succeed, or false if they are likelyto fail and this connection should be closed |
setSocketTimeout | void setSocketTimeout(int timeout)(Code) | | Sets the socket timeout value.
Parameters: timeout - timeout value in milliseconds |
shutdown | public void shutdown() throws IOException(Code) | | Force-closes this connection.
This is the only method of a connection which may be called
from a different thread to terminate the connection.
This method will not attempt to flush the transmitter's
internal buffer prior to closing the underlying socket.
|
|
|