org.vibur.objectpool.PoolService Java Examples
The following examples show how to use
org.vibur.objectpool.PoolService.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PoolOperations.java From vibur-dbcp with Apache License 2.0 | 5 votes |
/** * Instantiates the PoolOperations facade. * * @param dataSource the Vibur dataSource on which we will operate * @param connectionFactory the Vibur connection factory * @param poolService the Vibur pool service */ public PoolOperations(ViburDBCPDataSource dataSource, ViburObjectFactory connectionFactory, PoolService<ConnHolder> poolService) { this.dataSource = dataSource; this.connectionTimeoutInNanos = MILLISECONDS.toNanos(dataSource.getConnectionTimeoutInMs()); this.connectionFactory = connectionFactory; this.poolService = poolService; this.criticalSQLStates = new HashSet<>(Arrays.asList( whitespaces.matcher(dataSource.getCriticalSQLStates()).replaceAll("").split(","))); }
Example #2
Source File: ViburDBCPDataSource.java From vibur-dbcp with Apache License 2.0 | 5 votes |
private void doStart() throws ViburDBCPException { if (!state.compareAndSet(NEW, WORKING)) { throw new IllegalStateException(); } validateConfig(); if (getExternalDataSource() == null) { initJdbcDriver(); } if (getConnector() == null) { setConnector(buildConnector(this, getUsername(), getPassword())); } initDefaultHooks(); ViburObjectFactory connectionFactory = getConnectionFactory(); if (connectionFactory == null) { setConnectionFactory(connectionFactory = new ConnectionFactory(this)); } PoolService<ConnHolder> pool = getPool(); if (pool == null) { if (isPoolEnableConnectionTracking() && getTakenConnectionsFormatter() == null) { setTakenConnectionsFormatter(new TakenConnectionsFormatter.Default(this)); } pool = new ConcurrentPool<>(getConcurrentCollection(), connectionFactory, getPoolInitialSize(), getPoolMaxSize(), isPoolFair(), isPoolEnableConnectionTracking() ? new ViburListener(this) : null); setPool(pool); } poolOperations = new PoolOperations(this, connectionFactory, pool); initPoolReducer(); initStatementCache(); if (isEnableJMX()) { registerMBean(this); } }
Example #3
Source File: ConcurrentPoolTestPerf.java From vibur-object-pool with Apache License 2.0 | 5 votes |
private Worker(PoolService<Object> pool, AtomicInteger errors, long millis, long timeout, CountDownLatch readySignal, CountDownLatch startSignal, CountDownLatch doneSignal) { this.pool = pool; this.errors = errors; this.millis = millis; this.timeout = timeout; this.startSignal = startSignal; this.readySignal = readySignal; this.doneSignal = doneSignal; }
Example #4
Source File: ViburConfig.java From vibur-dbcp with Apache License 2.0 | 4 votes |
public PoolService<ConnHolder> getPool() { return pool; }
Example #5
Source File: ViburConfig.java From vibur-dbcp with Apache License 2.0 | 4 votes |
protected void setPool(PoolService<ConnHolder> pool) { this.pool = pool; }