@@ -80,9 +80,10 @@ public PooledConnection borrowDirectly(final String schema) {
8080 try {
8181 ConnectionPoolProvider .getConnGetFrenshLocekAfter ();
8282 ConnectionPoolProvider .borrowDirectlyConnectionBefore ();
83- int waiting = waiters .get ();
8483 for (PooledConnection conn : allConnections ) {
8584 if (conn .compareAndSet (STATE_NOT_IN_USE , STATE_IN_USE )) {
85+ final int waiting = waiterNum ;
86+ ConnectionPoolProvider .getWaiterCountAfter ();
8687 if (waiting > 0 && conn .getCreateByWaiter ().compareAndSet (true , false )) {
8788 ConnectionPoolProvider .newConnectionBorrowDirectly ();
8889 newPooledEntry (schema , waiting , true );
@@ -102,12 +103,12 @@ public PooledConnection borrow(final String schema, long timeout, final TimeUnit
102103 freshLock .readLock ().lock ();
103104 }
104105 try {
105- final int waiting = waiterNum ;
106106 ConnectionPoolProvider .getConnGetFrenshLocekAfter ();
107107 ConnectionPoolProvider .borrowConnectionBefore ();
108108 for (PooledConnection conn : allConnections ) {
109109 if (conn .compareAndSet (STATE_NOT_IN_USE , STATE_IN_USE )) {
110110 // If we may have stolen another waiter's connection, request another bag add.
111+ final int waiting = waiterNum ;
111112 if (waiting > 0 && conn .getCreateByWaiter ().compareAndSet (true , false )) {
112113 ConnectionPoolProvider .newConnectionBorrow0 ();
113114 newPooledEntry (schema , waiting , true );
0 commit comments