@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)); }
public Connection getConnection(AccessConfiguration configuration) throws DAOException { init(configuration); Connection connection = null; try { if (logger.isTraceEnabled()) logger.trace("Getting connection from pool "); if (logger.isTraceEnabled()) logger.trace(" getMaxPoolSize: " + cpds.getMaxPoolSize()); if (logger.isTraceEnabled()) logger.trace(" getNumConnections: " + cpds.getNumConnections()); if (logger.isTraceEnabled()) logger.trace(" getNumBusyConnections: " + cpds.getNumBusyConnections()); connection = cpds.getConnection(); if (logger.isTraceEnabled()) logger.trace("Opened connections: " + cpds.getNumConnections()); } catch (SQLException sqle) { close(connection); throw new DAOException( " getConnection: " + sqle + "\n\ndriver: " + configuration.getDriver() + " - uri: " + configuration.getUri() + " - login: "******" - password: "******"\n"); } if (connection == null) { throw new DAOException( "Connection is NULL !" + "\n\ndriver: " + configuration.getDriver() + " - uri: " + configuration.getUri() + " - login: "******" - password: "******"\n"); } return connection; }
protected String getStatus() { StringWriter sw = new StringWriter(); PrintWriter out = new PrintWriter(sw); if (datasource == null || !(datasource instanceof ComboPooledDataSource)) { out.println("Datasource" + getConfigInfoString() + ":"); out.println("~~~~~~~~~~~"); out.println("(not yet connected)"); return sw.toString(); } ComboPooledDataSource ds = (ComboPooledDataSource) datasource; out.println("Datasource" + getConfigInfoString() + ":"); out.println("~~~~~~~~~~~"); out.println("Jdbc url: " + ds.getJdbcUrl()); out.println("Jdbc driver: " + ds.getDriverClass()); out.println("Jdbc user: "******"Jdbc password: "******"Min pool size: " + ds.getMinPoolSize()); out.println("Max pool size: " + ds.getMaxPoolSize()); out.println("Initial pool size: " + ds.getInitialPoolSize()); out.println("Checkout timeout: " + ds.getCheckoutTimeout()); return sw.toString(); }
public int getMaxPoolSize() { return combods.getMaxPoolSize(); }