@Override public void close() { connectionFactory.stop(); }
private void logAfter(Connection connection, boolean checkout) { log(connection, checkout, false); }
public int getNumBusyConnectionsAllUsers() throws SQLException { return connectionPool.getNumBusyConnectionsAllUsers(); }
private void destroyTxConnection(Transaction tx) { Connection connection = transactionConnectionMap.remove(tx); if (connection != null) connectionFactory.releaseConnection(connection); }
@Override public Connection getConnection() throws PersistenceException { try { logBefore(true); Connection connection = connectionPool.getConnection(); logAfter(connection, true); return connection; } catch (SQLException e) { throw new PersistenceException("Failed obtaining connection from PooledDataSource", e); } }
private Connection getTxConnection(Transaction tx) { Connection connection = transactionConnectionMap.get(tx); if (connection == null) { connection = connectionFactory.getConnection(); transactionConnectionMap.put(tx, connection); } return connection; }
@Override public void start(ConnectionFactoryConfiguration config, ClassLoader classLoader) throws PersistenceException { PooledConnectionFactoryConfiguration poolConfig; if (config instanceof PooledConnectionFactoryConfiguration) { poolConfig = (PooledConnectionFactoryConfiguration) config; } else { throw new PersistenceException("ConnectionFactoryConfiguration passed in must be an instance of " + "PooledConnectionFactoryConfiguration"); } connectionPool = C3P0ConnectionPool.forceC3P0() ? new C3P0ConnectionPool(classLoader, poolConfig) : new HikariConnectionPool(classLoader, poolConfig); if (trace) log.tracef("Started connection factory with config: %s", config); }
@Override public void start(ConnectionFactoryConfiguration config, ClassLoader classLoader) throws PersistenceException { if (!started) { sharedFactory = new PooledConnectionFactory(); sharedFactory.start(config, classLoader); started = true; } }
@Override public int getNumConnectionsAllUsers() throws SQLException { // Only create hikari mbean if required if (hikariMxBean == null) initMBean(); return hikariMxBean.getActiveConnections(); }
public int getNumConnectionsAllUsers() throws SQLException { return connectionPool.getNumConnectionsAllUsers(); }
public int getMaxPoolSize() { return connectionPool.getMaxPoolSize(); }
@Override public void releaseConnection(Connection conn) { sharedFactory.releaseConnection(conn); } }
@Override public Connection getConnection() throws PersistenceException { return sharedFactory.getConnection(); }
public void stop() { simpleFactory.stop(); }
@Override public void stop() { if (connectionPool != null) { connectionPool.close(); if (trace) log.debug("Successfully stopped PooledConnectionFactory."); } }
@Override public Connection getConnection() throws SQLException { try { return simpleFactory.getConnection(); } catch (PersistenceException e) { throw new SQLException(e); } }
@Override public void close() { JdbcUtil.safeClose(rs); JdbcUtil.safeClose(ps); connectionFactory.releaseConnection(conn); } }
private void logBefore(boolean checkout) { log(null, checkout, true); }
@Override public int getNumBusyConnectionsAllUsers() throws SQLException { if (hikariMxBean == null) initMBean(); return hikariMxBean.getActiveConnections(); }