public class SocketPool
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.Hashtable |
allSockets |
protected java.util.Hashtable |
busySockets |
protected java.util.Hashtable |
freeSockets |
Constructor and Description |
---|
SocketPool()
Constructor for SocketPool.
|
Modifier and Type | Method and Description |
---|---|
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
|
protected java.util.Hashtable allSockets
protected java.util.Hashtable freeSockets
protected java.util.Hashtable busySockets
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 java.lang.Exception
java.lang.Exception
public void flush() throws java.io.IOException
java.io.IOException
Copyright © 2013. All Rights Reserved.