@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)); }
private void logBefore(boolean checkout) { if (log.isTraceEnabled()) { String operation = checkout ? "checkout" : "release"; try { log.trace( "DataSource before " + operation + " (NumBusyConnectionsAllUsers) : " + pooledDataSource.getNumBusyConnectionsAllUsers() + ", (NumConnectionsAllUsers) : " + pooledDataSource.getNumConnectionsAllUsers()); } catch (SQLException e) { log.warn("Unexpected", e); } } }
public int getNumConnectionsAllUsers() throws SQLException { return combods.getNumConnectionsAllUsers(); }