|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.locomotive.util.ObjectPool | +--org.locomotive.server.DBConnectionPool
Manages a pool of JDBC connections. Will broker the connections out until there are no more to give out, whereupon it will either attempt to start a new connection and send that out, or block if the maximum number of connections are already open until a connection is available.
Inner classes inherited from class org.locomotive.util.ObjectPool |
ObjectPool.PoolEntry |
Fields inherited from class org.locomotive.util.ObjectPool |
classname,
current_open,
isRunning,
log,
log_level,
max_open,
min_open,
pe_in_use_hash,
pe_stack,
poolentry_id_sequence |
Constructor Summary | |
DBConnectionPool()
Default constructor for the connection pool. |
|
DBConnectionPool(java.lang.String driver_classname_in,
java.lang.String url_in,
java.lang.String username_in,
java.lang.String password_in,
int min_open_in,
int max_open_in,
Log l)
creates a new pool, and fills it with the specified minumum number of database connections. |
Method Summary | |
java.lang.Object |
createNewObject()
creates a new database connection |
void |
destroyObject(java.lang.Object obj)
calls connection.close() on the object. |
java.sql.Connection |
getConnection()
gets a JDBC Connection object from the pool. |
static int |
getDefaultLogLevel()
|
java.lang.String |
getDriverClassName()
Get name of the driver class for this connection pool. |
java.lang.String |
getUrl()
Get the url to the database in this connection pool. |
java.lang.String |
getUserName()
Get the database username to use for connections in this pool. |
void |
returnToPool(java.lang.Object obj)
returns this connection to the pool, allowing other threads to have access to it. |
void |
setDriverClassName(java.lang.String driverClassName)
Set the driver class name for this connection pool. |
void |
setPassword(java.lang.String password)
Set the password for the username. |
void |
setUrl(java.lang.String url)
Set the url to the database in this connection pool. |
void |
setUserName(java.lang.String userName)
Set the database username to use for connections in this pool. |
void |
startService()
Start the DBConnectionPool service. |
Methods inherited from class org.locomotive.util.ObjectPool |
closeCurrentPoolMembers,
getLogLevel,
getMaxSize,
getMinSize,
getNextId,
getObject,
getPoolSize,
initialize,
isRunning,
log,
logError,
setLog,
setLogLevel,
setMaxSize,
setMinSize,
stopService,
wipeFromPool |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public DBConnectionPool(java.lang.String driver_classname_in, java.lang.String url_in, java.lang.String username_in, java.lang.String password_in, int min_open_in, int max_open_in, Log l) throws InitializationException
driver_classname_in
- the class name for the JDBC driver to
use.url_in
- the URL to use with the driver. See the driver
documanetation for more details.username_in
- the username to connect to the database withpassword_in
- the user's passwordmin_open_in
- the minumum number of connections to remain
in the poolmax_open_in
- the maximum number of connections to
maintain at any given timel
- the log to use to log any major eventsid
- the unique id for this pool- pass -1 to not use an idpublic DBConnectionPool()
Method Detail |
public static int getDefaultLogLevel()
public java.lang.Object createNewObject() throws InitializationException
public void destroyObject(java.lang.Object obj)
public java.sql.Connection getConnection()
public void returnToPool(java.lang.Object obj)
public void startService() throws ServiceException
public java.lang.String getDriverClassName()
public void setDriverClassName(java.lang.String driverClassName)
driverClassName
- The name of the driver class for
this connection pool.public java.lang.String getUrl()
public void setUrl(java.lang.String url)
url
- the url to the database in this connection pool.public java.lang.String getUserName()
public void setUserName(java.lang.String userName)
userName
- The database username.public void setPassword(java.lang.String password)
password
- The password for the username.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |