@Override
 public Connection getAnyConnection() throws SQLException {
   ComboPooledDataSource cpds = connProviderMap.get(CurrentTenantResolver.DEFAULT_TENANT_ID);
   logger.debug(
       "Get Default Connection:::Number of connections (max: busy - idle): {} : {} - {}",
       new int[] {
         cpds.getMaxPoolSize(),
         cpds.getNumBusyConnectionsAllUsers(),
         cpds.getNumIdleConnectionsAllUsers()
       });
   if (cpds.getNumConnectionsAllUsers() == cpds.getMaxPoolSize()) {
     logger.warn("Maximum number of connections opened");
   }
   if (cpds.getNumConnectionsAllUsers() == cpds.getMaxPoolSize()
       && cpds.getNumIdleConnectionsAllUsers() == 0) {
     logger.error("Connection pool empty!");
   }
   return cpds.getConnection();
 }
 @Override
 public Connection getConnection(String tenantIdentifier) throws SQLException {
   ComboPooledDataSource cpds = connProviderMap.get(tenantIdentifier);
   logger.debug(
       "Get {} Connection:::Number of connections (max: busy - idle): {} : {} - {}",
       new Object[] {
         tenantIdentifier,
         cpds.getMaxPoolSize(),
         cpds.getNumBusyConnectionsAllUsers(),
         cpds.getNumIdleConnectionsAllUsers()
       });
   if (cpds.getNumConnectionsAllUsers() == cpds.getMaxPoolSize()) {
     logger.warn("Maximum number of connections opened");
   }
   if (cpds.getNumConnectionsAllUsers() == cpds.getMaxPoolSize()
       && cpds.getNumIdleConnectionsAllUsers() == 0) {
     logger.error("Connection pool empty!");
   }
   return cpds.getConnection();
   // return cpds.getConnection(tenantIdentifier, (String) props.get(tenantIdentifier));
 }
Exemplo n.º 3
0
 public int getNumIdleConnectionsAllUsers() throws SQLException {
   return combods.getNumIdleConnectionsAllUsers();
 }