/** * Fill the pool up to the minimum size. */ private void initializeConnections() { if (config.isInitializationFailFast()) { try { if (!addConnection()) { throw lastConnectionFailure.getAndSet(null); } ConnectionProxy connection = (ConnectionProxy) getConnection(); connection.getPoolBagEntry().evict = (config.getMinimumIdle() == 0); connection.close(); } catch (Throwable e) { try { shutdown(); } catch (Throwable ex) { e.addSuppressed(ex); } throw new PoolInitializationException(e); } } fillPool(); }
public static boolean getConnectionCommitDirtyState(Connection connection) { try { Field field = ConnectionProxy.class.getDeclaredField("isCommitStateDirty"); field.setAccessible(true); return field.getBoolean(connection); } catch (Exception e) { throw new RuntimeException(e); } }
/** * @see com.eclecticlogic.pedal.connection.ConnectionAccessor#getRawConnection(java.sql.Connection) */ @Override public Connection getRawConnection(Connection providerConnection) { try { return ((ConnectionProxy) providerConnection).unwrap(Connection.class); } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } }
@Override public PGConnection unwrapPgConnection(Connection conn) throws SQLException { ConnectionProxy proxy = (ConnectionProxy) conn; return proxy.<PGConnection> unwrap(PGConnection.class); }
@BeforeClass public static void setUp() throws NoSuchMethodException { getConnectionMethod1 = HikariDataSource.class.getDeclaredMethod("getConnection"); getConnectionMethod2 = HikariDataSource.class.getDeclaredMethod("getConnection", String.class, String.class); proxyConnectionMethod = ConnectionProxy.class.getDeclaredMethod("close"); }