|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.globus.ftp.dc.SocketPool
public class SocketPool
Represents a set of open sockets that are being cached for subsequent transfers. CheckIn() a socket to add it to the pool. Other threads can use it. CheckOut() a socket to mark it busy; it will remain in the pool but noone else can check it out. Finally, you can remove a socket from the pool, in which case the pool will remove it from all its references.
Field Summary | |
---|---|
protected Hashtable |
allSockets
|
protected Hashtable |
busySockets
|
protected Hashtable |
freeSockets
|
Constructor Summary | |
---|---|
SocketPool()
Constructor for SocketPool. |
Method Summary | |
---|---|
void |
add(SocketBox sb)
add socketBox to the pool. |
void |
applyToAll(SocketOperator op)
Apply the suplied callback to all socketBoxes. |
void |
checkIn(SocketBox sb)
Before calling this method, the socket needs to be first add()ed to the pool and checked out. |
SocketBox |
checkOut()
checks out the next free socket and returns it, or returns null if there aren't any. |
int |
count()
|
int |
countBusy()
|
int |
countFree()
|
void |
flush()
Forcibly close all sockets, and remove them from the pool. |
boolean |
hasFree()
|
void |
remove(SocketBox sb)
remove socketBox from the pool, remove all references to it |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Hashtable allSockets
protected Hashtable freeSockets
protected Hashtable busySockets
Constructor Detail |
---|
public SocketPool()
Method Detail |
---|
public void add(SocketBox sb)
public void remove(SocketBox sb)
public SocketBox checkOut()
public void checkIn(SocketBox sb)
public int count()
public int countFree()
public int countBusy()
public boolean hasFree()
public void applyToAll(SocketOperator op) throws Exception
Exception
public void flush() throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |