|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsunlabs.brazil.util.http.HttpRequest.SimpleHttpSocketPool
public static class HttpRequest.SimpleHttpSocketPool
Field Summary | |
---|---|
int |
maxAge
|
int |
maxIdle
|
int |
reapInterval
|
Constructor Summary | |
---|---|
HttpRequest.SimpleHttpSocketPool()
Use the default pool settings |
|
HttpRequest.SimpleHttpSocketPool(int maxIdle,
int maxAge,
int reapInterval)
Create a socket pool. |
Method Summary | |
---|---|
void |
close(HttpRequest.HttpSocket hs,
boolean reuse)
Releases an HttpSocket to this pool when it is not
in use any more. |
HttpRequest.HttpSocket |
get(String host,
int port,
boolean reuse)
Get a potentially "pooled" target object. |
int |
getDefaultPort()
Return the default port (this doesn't belong here) |
boolean |
isMine(URL url)
Return true if this is one of the url's my pool can handle |
void |
run()
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public int maxIdle
public int maxAge
public int reapInterval
Constructor Detail |
---|
public HttpRequest.SimpleHttpSocketPool(int maxIdle, int maxAge, int reapInterval)
maxIdle
- (ms) Max number of idle connectionsmaxAge
- (ms) Max idle time for a connectionreapInterval
- (ms) How often to check for expired socketspublic HttpRequest.SimpleHttpSocketPool()
Method Detail |
---|
public boolean isMine(URL url)
HttpRequest.HttpSocketPool
isMine
in interface HttpRequest.HttpSocketPool
public int getDefaultPort()
HttpRequest.HttpSocketPool
getDefaultPort
in interface HttpRequest.HttpSocketPool
public HttpRequest.HttpSocket get(String host, int port, boolean reuse) throws IOException, UnknownHostException
get
in interface HttpRequest.HttpSocketPool
host
- the target content server (or web proxy)port
- target web server portreuse
- true
to request that this pool attempt to
find and reuse an existing idle connection,
false
to request that this pool establish a new connection to
the named host.
HttpSocket
.
IOException
- if there is a problem connecting the specified port on
the named host. The IOException
s (and
subclasses) that might be thrown depend upon how the
socket connection is established. See the socket
documentation for further details. Some subclasses that
might be thrown are as follows:
InterruptedIOException
- if the connection times out or this thread is
interrupted by Thread.interrupt
.
UnknownHostException
public void close(HttpRequest.HttpSocket hs, boolean reuse)
HttpRequest.HttpSocketPool
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
, e.g. closing the underlying socket.
After calling this method, the user should not refer to the specified
HttpSocket
any more.
close
in interface HttpRequest.HttpSocketPool
hs
- The HttpSocket
to release.reuse
- true
: the specified HttpSocket
should be put back into the idle pool,
false
if it should be released immediately.public void run()
run
in interface Runnable
public String toString()
toString
in class Object
|
Version Kenai-svn-r24, Generated 08/18/09 Copyright (c) 2001-2009, Sun Microsystems. |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |