@@ -28,6 +28,9 @@ public class SimpleDBConnectionPoolConfig {
28
28
private String [] highAvailabilitySites = null ;
29
29
private int tryReconnectNums = -1 ;
30
30
31
+ private boolean isMinimumPoolSizeUserSet = false ;
32
+ private boolean isMaximumPoolSizeUserSet = false ;
33
+
31
34
private static final Logger log = LoggerFactory .getLogger (DBConnection .class );
32
35
33
36
public SimpleDBConnectionPoolConfig () {
@@ -85,6 +88,7 @@ public void setInitialPoolSize(int initialPoolSize) {
85
88
86
89
public void setMinimumPoolSize (int minimumPoolSize ) {
87
90
this .minimumPoolSize = minimumPoolSize ;
91
+ this .isMinimumPoolSizeUserSet = true ;
88
92
}
89
93
90
94
public int getMinimumPoolSize () {
@@ -93,6 +97,7 @@ public int getMinimumPoolSize() {
93
97
94
98
public void setMaximumPoolSize (int maximumPoolSize ) {
95
99
this .maximumPoolSize = maximumPoolSize ;
100
+ this .isMaximumPoolSizeUserSet = true ;
96
101
}
97
102
98
103
public int getMaximumPoolSize () {
@@ -201,7 +206,7 @@ protected void validate() {
201
206
log .warn ("Login needs password." );
202
207
}
203
208
204
- if (initialPoolSize > 0 && minimumPoolSize == - 1 && maximumPoolSize == - 1 ) {
209
+ if (initialPoolSize > 0 && ! isMinimumPoolSizeUserSet && ! isMaximumPoolSizeUserSet ) {
205
210
// 兼容旧版逻辑(只填init,不填mini、max的场景):将最小、最大设置为 initialPoolSize 的值
206
211
minimumPoolSize = initialPoolSize ;
207
212
maximumPoolSize = initialPoolSize ;
0 commit comments