|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mymed.controller.core.manager.connection.ConnectionPool
public class ConnectionPool
Implementation of a connection pool
Constructor Summary | |
---|---|
ConnectionPool(java.lang.String address,
int port)
Create a new connection pool with a maximum capacity of 100. |
|
ConnectionPool(java.lang.String address,
int port,
int capacity)
Create a new connection pool with initial capacity defined by capacity . |
Method Summary | |
---|---|
void |
checkIn(IConnection connection)
Give a connection back to the pool |
IConnection |
checkOut()
Get a connection from the pool |
int |
getCapacity()
Get the maximum capacity of the pool |
int |
getSize()
Get the size of the pool, or how many connections are in it |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConnectionPool(java.lang.String address, int port)
address
- the address where to connect toport
- the port to use for the connectionpublic ConnectionPool(java.lang.String address, int port, int capacity)
capacity
. If capacity
is zero, the pool is limit-less.
address
- the address where to connect toport
- the port to use for the connectioncapacity
- the maximum capacity of the poolMethod Detail |
---|
public IConnection checkOut()
IConnectionPool
checkOut
in interface IConnectionPool
public void checkIn(IConnection connection)
IConnectionPool
checkIn
in interface IConnectionPool
connection
- the connection to return to the poolpublic int getSize()
IConnectionPool
getSize
in interface IConnectionPool
public int getCapacity()
IConnectionPool
getCapacity
in interface IConnectionPool
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |