|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
net.jot.db.JOTDBPool
public class JOTDBPool
This is an implementation of a database connection pooling system It manages connections, adds some when needed, and periodically check there status and renew them is they appear corrupt/hung. It also release connections if they aren't used for a while.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary |
|---|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
JOTDBPool(java.lang.String name,
JOTDBJDBCSetup setup)
Create appol for a particular DB |
|
| Method Summary | |
|---|---|
void |
dropAll()
Release/closes all the connections |
void |
dropConnection(int i)
Release/removes a connection |
void |
finalize()
will automatically call shutdown when java app is terminated, to avoid hung DB connections. |
void |
releaseConnection(java.sql.Connection con,
int i)
Description of the Method |
void |
releaseConnection(JOTTaggedConnection con)
free a connection when not usefull anymore. |
java.sql.Connection |
renewConnection(int index)
Renew a connection when it got corrupted. |
JOTTaggedConnection |
retrieveConnection()
This get a connection from the pool Returns the "first available". |
void |
run()
The run thread method is there as a whatchdog It will try to find out when connections aren't needed anymore And free them if possible. |
void |
shutdown()
Terminates a pool and releases resources |
void |
updateAccessTime(int id)
Updates the last time a pooled connection was used, so we can manage it better. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JOTDBPool(java.lang.String name,
JOTDBJDBCSetup setup)
setup - Description of Parameter| Method Detail |
|---|
public void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic void releaseConnection(JOTTaggedConnection con)
con - Description of Parameter
public void releaseConnection(java.sql.Connection con,
int i)
con - Description of the Parameteri - Description of the Parameterpublic JOTTaggedConnection retrieveConnection()
public java.sql.Connection renewConnection(int index)
index - Description of Parameter
public void dropConnection(int i)
i - Description of the Parameterpublic void dropAll()
public void shutdown()
public void finalize()
finalize in class java.lang.Objectpublic void updateAccessTime(int id)
dataId - Description of the Parameter
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||