| sunlabs.brazil.util.http.HttpSocketPool
HttpSocketPool | public interface HttpSocketPool (Code) | | This interface represents a cache of idle sockets. Once a request has
been handled, the now-idle socket can be remembered and reused later in
case another HTTP request is made to the same remote host. Currently, the
only instance of this interface is used by the HttpRequest
class.
author: Colin Stevens (colin.stevens@sun.com) version: 1.6 99/10/14 |
Method Summary | |
public void | close(HttpSocket hs, boolean reuse) Releases an HttpSocket to this pool when it is not
in use any more. | public HttpSocket | get(String host, int port, boolean reuse) Returns an HttpSocket that can be used to communicate
with the specified port on the named host.
It is this method's responsibility to to fill in all the public
member variables of the HttpSocket before returning.
For each call to this method, there should eventually be a call to
close when the HttpSocket isn't needed
anymore.
Parameters: host - The host name. Parameters: port - The port number. Parameters: reuse - true to request that this pool attempt to findand reuse an existing idle connection, false to request that this pool establish a new connection tothe named host. The HttpSocket . throws: IOException - if there is a problem connecting to the specified port onthe named host. |
close | public void close(HttpSocket hs, boolean reuse)(Code) | | Releases an HttpSocket to this pool when it is not
in use any more.
It is this method's responsibility to release resources used
by the HttpSocket , such as closing the underlying socket.
After calling this method, the user should not refer to the specified
HttpSocket any more.
Parameters: hs - The HttpSocket to release. Parameters: reuse - true if the specified HttpSocket should be put back into the idle pool, false if it should be released immediately. |
get | public HttpSocket get(String host, int port, boolean reuse) throws IOException(Code) | | Returns an HttpSocket that can be used to communicate
with the specified port on the named host.
It is this method's responsibility to to fill in all the public
member variables of the HttpSocket before returning.
For each call to this method, there should eventually be a call to
close when the HttpSocket isn't needed
anymore.
Parameters: host - The host name. Parameters: port - The port number. Parameters: reuse - true to request that this pool attempt to findand reuse an existing idle connection, false to request that this pool establish a new connection tothe named host. The HttpSocket . throws: IOException - if there is a problem connecting to the specified port onthe named host. The IOException s (and subclasses) that might be thrown depend upon how thesocket connection is established. See the socketdocumentation for further details. Some subclasses thatmight be thrown are as follows: throws: java.io.UnknownHostException - if the host name cannot be resolved. throws: java.io.ConnectionException - if the named host is not listening on the specified port. throws: java.io.InterruptedIOException - if the connection times out or this thread is interrupted byThread.interrupt . |
|
|