|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--java.lang.Thread
|
+--ConnectionPool
This is a Connection pool. It uses RestartableThread.
| Field Summary | |
static int |
DEFAULT_SLEEP_TIME
manager will use it as sleep time if connections are still available |
java.util.Vector |
free_threads
|
protected java.lang.Thread |
manager
Thread used to manage the pool |
static int |
URGENT_SLEEP_TIME
manager will use it s sleep time if no more connections are available |
java.util.Vector |
used_threads
|
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
ConnectionPool(int maxThread,
int minThread,
int maxSpareThread,
int minSpareThread)
Create a ConectionPool. |
|
| Method Summary | |
Connection |
getConnection()
Get a Thread. |
int |
getMaxSpareThread()
Get the current max of free threads. |
int |
getMaxThread()
Get the current max of concurrent threads. |
int |
getMinSpareThread()
Get the current min of free threads. |
int |
getMinThread()
Get the current min of concurrent threads. |
void |
killConnection(Connection c)
Kills a connection given its reference |
void |
returnConnection(Connection c)
Return a thread to the pool. |
void |
run()
The cleaner thread is used to maintain the number of threads within the values defined by MAX_THREAD, MIN_THREAD, MAX_SPARE_THREAD and MIN_SPARE_THREAD |
void |
setMaxSpareThread(int maxSpareThread)
Set the max number of free threads |
void |
setMaxThread(int maxThread)
Set the max number of threads, |
void |
setMinSpareThread(int minSpareThread)
Set the min number of free threads |
void |
setMinThread(int minThread)
Set the min number of threads |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public java.util.Vector free_threads
public java.util.Vector used_threads
protected java.lang.Thread manager
public static int DEFAULT_SLEEP_TIME
public static int URGENT_SLEEP_TIME
| Constructor Detail |
public ConnectionPool(int maxThread,
int minThread,
int maxSpareThread,
int minSpareThread)
maxThread - max number of concurrent threads.minThread - min number of concurrent threads.maxSpareThread - max number of free (unused) threads.minSpareThread - min number of free (unused) threads.| Method Detail |
public void setMaxThread(int maxThread)
maxThread - the new max of concurrent threads.public int getMaxThread()
public void setMinThread(int minThread)
minThread - the new min of concurrent threads.public int getMinThread()
public void setMaxSpareThread(int maxSpareThread)
maxSpareThread - the new max of free threads.public int getMaxSpareThread()
public void setMinSpareThread(int minSpareThread)
minSpareThread - the new min of free threads.public int getMinSpareThread()
public void killConnection(Connection c)
c - the Connection to be closedpublic Connection getConnection()
public void returnConnection(Connection c)
c - the Connection to return.public void run()
run in class java.lang.Thread
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||