List of usage examples for org.apache.commons.pool2.impl GenericObjectPool getNumActive
@Override public int getNumActive()
From source file:org.apache.ofbiz.entity.connection.DebugManagedDataSource.java
@Override public Connection getConnection() throws SQLException { if (Debug.verboseOn()) { if (super.getPool() instanceof GenericObjectPool) { GenericObjectPool objectPool = (GenericObjectPool) super.getPool(); Debug.logVerbose("Borrowing a connection from the pool; used/idle/total: " + objectPool.getNumActive() + "/" + objectPool.getNumIdle() + "/" + (objectPool.getNumActive() + objectPool.getNumIdle()) + "; min idle/max idle/max total: " + objectPool.getMinIdle() + "/" + objectPool.getMaxIdle() + "/" + objectPool.getMaxTotal(), module);//from w w w . j ava 2s .com } else { Debug.logVerbose("Borrowing a connection from the pool; used/idle/total: " + super.getPool().getNumActive() + "/" + super.getPool().getNumIdle() + "/" + (super.getPool().getNumActive() + super.getPool().getNumIdle()), module); } } return super.getConnection(); }
From source file:org.apache.openejb.resource.jdbc.DbcpNPEXAConnectionTest.java
@Test public void check() throws SQLException { final Connection con = ejb.newConn(); con.close(); // no NPE Assert.assertTrue("Connection was not closed", con.isClosed()); final GenericObjectPool<PoolableConnection> pool = GenericObjectPool.class .cast(Reflections.get(ds, "connectionPool")); assertEquals(0, pool.getNumActive()); }