File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/main/java/com/alipay/oceanbase/rpc/table Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -759,10 +759,16 @@ public ObTableConnection getConnection() {
759759 * 4. Attempt to reconnect the marked connections.
760760 **/
761761 private void checkAndReconnect () {
762+ // do nothing when there is only 1 connection
763+ if (obTableConnectionPoolSize == 1 ) {
764+ return ;
765+ }
766+
762767 // Iterate over the connection pool to identify connections that have expired
763768 List <Integer > expiredConnIds = new ArrayList <>();
769+ long num = turn .get ();
764770 for (int i = 1 ; i <= obTableConnectionPoolSize ; ++i ) {
765- int idx = (int ) ((i + turn . get () ) % obTableConnectionPoolSize );
771+ int idx = (int ) ((i + num ) % obTableConnectionPoolSize );
766772 if (connectionPool [idx ].checkExpired ()) {
767773 expiredConnIds .add (idx );
768774 }
You can’t perform that action at this time.
0 commit comments