|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pf.util.ExceptionIgnorer
org.pf.net.ConnectionPool
public class ConnectionPool
This class provides a mechanism to reuse established connections rather than creating new ones every time. This results in a significant performance increase.
| Constructor Summary | |
|---|---|
ConnectionPool(java.lang.String hostname,
int port)
Initialize the new instance with the hostname and the port of the server to connect to. |
|
ConnectionPool(java.lang.String hostname,
int port,
ExceptionHandler exHandler)
Initialize the new instance with the hostname and the port of the server to connect to. |
|
ConnectionPool(java.lang.String hostname,
int port,
int poolLimit)
Initialize the new instance with the hostname and the port of the server to connect to. |
|
ConnectionPool(java.lang.String hostname,
int port,
int poolLimit,
ExceptionHandler exHandler)
Initialize the new instance with the hostname and the port of the server to connect to. |
|
| Method Summary | |
|---|---|
void |
createConnections(int numberOfConnections)
Creates connections ready to be used in the pool. |
TextSocketConnection |
getConnection()
Returns a connection based on the underlying socket. |
int |
numberOfPooledConnections()
Returns how many connections are in the pool |
void |
returnConnection(TextSocketConnection connection)
|
| Methods inherited from class org.pf.util.ExceptionIgnorer |
|---|
exceptionOccurred, getExceptionHandler, setExceptionHandler |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConnectionPool(java.lang.String hostname,
int port)
hostname - The name of the server to which the pool should connect toport - The port on the host on which the server process is listening
public ConnectionPool(java.lang.String hostname,
int port,
int poolLimit)
hostname - The name of the server to which the pool should connect toport - The port on the host on which the server process is listeningpoolLimit - The maximum number of connections to be pooled ( must be > 1 )
public ConnectionPool(java.lang.String hostname,
int port,
ExceptionHandler exHandler)
hostname - The name of the server to which the pool should connect toport - The port on the host on which the server process is listeningexHandler - An optional handler that gets called for all occuring exceptions
public ConnectionPool(java.lang.String hostname,
int port,
int poolLimit,
ExceptionHandler exHandler)
hostname - The name of the server to which the pool should connect toport - The port on the host on which the server process is listeningpoolLimit - The maximum number of connections to be pooled ( must be > 1 )exHandler - An optional handler that gets called for all occuring exceptions| Method Detail |
|---|
public TextSocketConnection getConnection()
public void returnConnection(TextSocketConnection connection)
public void createConnections(int numberOfConnections)
public int numberOfPooledConnections()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||