List of usage examples for javax.sql ConnectionPoolDataSource getLogWriter
@Override
java.io.PrintWriter getLogWriter() throws SQLException;
From source file:biz.source_code.miniConnectionPoolManager.TestMiniConnectionPoolManager.java
/** * Constructs a MiniConnectionPoolManager object. * @param dataSource the data source for the connections. * @param maxConnections the maximum number of connections. * @param timeout the maximum time in seconds to wait for a free connection. *//*from w w w. j a v a2 s . com*/ public MiniConnectionPoolManager(ConnectionPoolDataSource dataSource, int maxConnections, int timeout) { this.dataSource = dataSource; this.maxConnections = maxConnections; this.timeout = timeout; try { logWriter = dataSource.getLogWriter(); } catch (SQLException e) { } if (maxConnections < 1) throw new IllegalArgumentException("Invalid maxConnections value."); semaphore = new Semaphore(maxConnections, true); recycledConnections = new Stack<PooledConnection>(); poolConnectionEventListener = new PoolConnectionEventListener(); }
From source file:com.alibaba.wasp.jdbcx.JdbcConnectionPool.java
protected JdbcConnectionPool(ConnectionPoolDataSource dataSource, Configuration conf) { this.dataSource = dataSource; this.conf = conf; this.maxConnections = conf.getInt(FConstants.JDBC_POOL_MAX_CONNECTIONS, FConstants.DEFAULT_JDBC_POOL_MAX_CONNECTIONS); this.timeout = conf.getInt(FConstants.JDBC_CONNECTION_TIMEOUT, FConstants.DEFAULT_JDBC_CONNECTION_TIMEOUT); if (dataSource != null) { try {//from w w w. ja v a2s . c o m logWriter = dataSource.getLogWriter(); } catch (SQLException e) { // ignore } } }