mirror of
https://github.com/actiontech/dble.git
synced 2026-01-06 04:40:17 -06:00
fix: the timing of obtaining the number of waiting threads in the connection pool is wrong
This commit is contained in:
@@ -80,9 +80,10 @@ public class ConnectionPool extends PoolBase implements PooledConnectionListener
|
||||
try {
|
||||
ConnectionPoolProvider.getConnGetFrenshLocekAfter();
|
||||
ConnectionPoolProvider.borrowDirectlyConnectionBefore();
|
||||
int waiting = waiters.get();
|
||||
for (PooledConnection conn : allConnections) {
|
||||
if (conn.compareAndSet(STATE_NOT_IN_USE, STATE_IN_USE)) {
|
||||
final int waiting = waiterNum;
|
||||
ConnectionPoolProvider.getWaiterCountAfter();
|
||||
if (waiting > 0 && conn.getCreateByWaiter().compareAndSet(true, false)) {
|
||||
ConnectionPoolProvider.newConnectionBorrowDirectly();
|
||||
newPooledEntry(schema, waiting, true);
|
||||
@@ -102,12 +103,12 @@ public class ConnectionPool extends PoolBase implements PooledConnectionListener
|
||||
freshLock.readLock().lock();
|
||||
}
|
||||
try {
|
||||
final int waiting = waiterNum;
|
||||
ConnectionPoolProvider.getConnGetFrenshLocekAfter();
|
||||
ConnectionPoolProvider.borrowConnectionBefore();
|
||||
for (PooledConnection conn : allConnections) {
|
||||
if (conn.compareAndSet(STATE_NOT_IN_USE, STATE_IN_USE)) {
|
||||
// If we may have stolen another waiter's connection, request another bag add.
|
||||
final int waiting = waiterNum;
|
||||
if (waiting > 0 && conn.getCreateByWaiter().compareAndSet(true, false)) {
|
||||
ConnectionPoolProvider.newConnectionBorrow0();
|
||||
newPooledEntry(schema, waiting, true);
|
||||
|
||||
@@ -51,5 +51,9 @@ public final class ConnectionPoolProvider {
|
||||
|
||||
}
|
||||
|
||||
public static void getWaiterCountAfter() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user