15724757448 commented on issue #10640:
URL: 
https://github.com/apache/shardingsphere/issues/10640#issuecomment-853803027


   -----------code----------
   > public final List getConnections(final ConnectionMode connectionMode, 
final String dataSourceName, final int connectionSize) throws SQLException {
   > DataSource dataSource = getDataSourceMap().get(dataSourceName);
   > Preconditions.checkState(null != dataSource, "Missing the data source 
name: '%s'", dataSourceName);
   > Collection connections;
   > synchronized (cachedConnections) {
   > connections = cachedConnections.get(dataSourceName);
   > }
   > List result;
   > if (connections.size() >= connectionSize) {
   > result = new ArrayList<>(connections).subList(0, connectionSize);
   > } else if (!connections.isEmpty()) {
   > result = new ArrayList<>(connectionSize);
   > result.addAll(connections);
   > List newConnections = createConnections(dataSourceName, connectionMode, 
dataSource, connectionSize - connections.size());
   > result.addAll(newConnections);
   > synchronized (cachedConnections) {
   > cachedConnections.putAll(dataSourceName, newConnections);
   > }
   > } else {
   > result = new ArrayList<>(createConnections(dataSourceName, connectionMode, 
dataSource, connectionSize));
   > synchronized (cachedConnections) {
   > cachedConnections.putAll(dataSourceName, result);
   > }
   > }
   > return result;
   > }
   > 
   -----------question------
   > When cachedconnections > = connectionsize, the data source is obtained 
from cachedconnections. If the maximum number of connections of the data source 
is greater than max.connections.size.per.query, will the maximum number of 
links never be used?
   > 
   > for example
   > 
   > true 20 20
   > maxActive=80. max.connections.size.per.query=20
   > If this data source is only used by shardingDataSource, is maxactive 
limited to 20 at most?
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to