public class SocketPool extends Object
Modifier and Type | Field and Description |
---|---|
protected Hashtable |
allSockets |
protected Hashtable |
busySockets |
protected 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 Hashtable allSockets
protected Hashtable freeSockets
protected 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 Exception
Exception
public void flush() throws IOException
IOException
Copyright © 2016. All rights reserved.