mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-08-03 06:17:03 +08:00
cache connection
This commit is contained in:
@ -556,6 +556,7 @@ public class ConnectInfo {
|
||||
copy.setDriverConfig(this.getDriverConfig());
|
||||
copy.setSid(this.getSid());
|
||||
copy.setUrlWithOutDatabase(this.getUrlWithOutDatabase());
|
||||
copy.setLastAccessTime(new Date());
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
@ -120,6 +120,7 @@ public class ConnectionPool {
|
||||
synchronized (lock) {
|
||||
int n = lock.decrementRefCount();
|
||||
if (n == 0) {
|
||||
lock.setLastAccessTime(new Date());
|
||||
lock.setConnection(connectInfo.getConnection());
|
||||
} else {
|
||||
connectInfo.close();
|
||||
|
Reference in New Issue
Block a user