public class DBConnectionPool
extends java.lang.Object
implements java.lang.Runnable
Modifier and Type | Method and Description |
---|---|
static DBConnection |
getDBConnection(java.lang.String methodName)
Method to get a DBConnection in connection pool
1) try to get a DBConnection from DBConnection pool
2) if 1) failed, then check the size of pool.
|
static DBConnectionPool |
getInstance()
Returns the single instance, creating one if it's the
first time this method is called.
|
int |
getSizeOfDBConnectionPool()
Method to get the size of DBConnectionPool
|
static void |
release()
Method to shut down all connections
|
static void |
returnDBConnection(DBConnection conn,
int serialNumber)
Method to return a connection to DBConnection pool.
|
void |
run()
periodically to recycle the connection
|
static boolean |
shrinkConnectionPoolSize()
Method to decrease dbconnection pool size when all dbconnections are idle
If all connections are free and connection pool size greater than initial
value, shrink connection pool size to initial value
|
static void |
shrinkDBConnectionPoolSize()
Method to decrease dbconnection pool size when all dbconnections are idle
If all connections are free and connection pool size greater than
initial value, shrink connection pool size to intital value
|
public static DBConnectionPool getInstance() throws java.sql.SQLException
java.sql.SQLException
public int getSizeOfDBConnectionPool()
public static DBConnection getDBConnection(java.lang.String methodName) throws java.sql.SQLException
methodName,
- the name of method which will check connection outjava.sql.SQLException
public static void returnDBConnection(DBConnection conn, int serialNumber)
conn,
- the Connection object need to check inpublic static void release()
public void run()
run
in interface java.lang.Runnable
public static boolean shrinkConnectionPoolSize()
public static void shrinkDBConnectionPoolSize()
Copyright © 2020 Regents of the University of California. All Rights Reserved.