File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed
jdbc/src/main/java/tech/ydb/jdbc/settings Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change 33import java .util .Map ;
44
55import javax .annotation .Nullable ;
6- import tech .ydb .core .grpc .GrpcTransport ;
76
7+ import tech .ydb .core .grpc .GrpcTransport ;
88import tech .ydb .table .TableClient ;
99
1010public class YdbClientProperties {
@@ -30,11 +30,21 @@ public TableClient toTableClient(GrpcTransport grpc) {
3030 entry .getKey ().getSetter ().accept (builder , entry .getValue ().getParsedValue ());
3131 }
3232 }
33- ParsedProperty minSize = params .get (YdbClientProperty .SESSION_POOL_SIZE_MIN );
34- ParsedProperty maxSize = params .get (YdbClientProperty .SESSION_POOL_SIZE_MAX );
35- if (minSize != null && maxSize != null ) {
36- builder .sessionPoolSize (minSize .getParsedValue (), maxSize .getParsedValue ());
33+
34+ int minSize = 0 ;
35+ int maxSize = 50 ;
36+
37+ ParsedProperty minSizeConfig = params .get (YdbClientProperty .SESSION_POOL_SIZE_MIN );
38+ ParsedProperty maxSizeConfig = params .get (YdbClientProperty .SESSION_POOL_SIZE_MAX );
39+
40+ if (minSizeConfig != null ) {
41+ minSize = Math .max (0 , minSizeConfig .getParsedValue ());
42+ maxSize = Math .min (maxSize , minSize );
43+ }
44+ if (maxSizeConfig != null ) {
45+ maxSize = Math .max (minSize , maxSizeConfig .getParsedValue ());
3746 }
38- return builder .build ();
47+
48+ return builder .sessionPoolSize (minSize , maxSize ).build ();
3949 }
4050}
You can’t perform that action at this time.
0 commit comments