- Common ways to obtain GenericObjectPool
private void myMethod () {GenericObjectPool g =
new GenericObjectPool()
new GenericObjectPool(null)
PoolableObjectFactory factory;new GenericObjectPool(factory)
- Smart code suggestions by Codota
}
@Override public void close() throws SQLException { try { connectionPool.returnObject(this); } catch (Exception e) { throw new SQLException(e); } }
protected void returnObject(Channel channel) { if (channel == null) { return; } try { pool.returnObject(channel); } catch (Exception ie) { LoggerUtil.error(this.getClass().getSimpleName() + " return client Error: url=" + url.getUri(), ie); } }
returnObject(latch.getPair().getValue());
public void releasePoolable(Object object) throws Exception { this.pool.returnObject(object); }
/** * Return the session Object to the ConnectionPool. Method must be synchronized, in order to * prevent SessionPool from opening more connections than in max.Connection defined under heavy * load * * @param session * @throws Exception */ public synchronized void returnObject(Session session) throws Exception { openSessionsNonTransactional.remove(session); pool.returnObject(session); }
pool.returnObject(preload[i]);
/** * Places the given LdapConnection back in the pool. * * @param connection the LdapConnection to be released * @throws Exception if an error occurs while releasing the connection */ public void releaseConnection(LdapConnection connection) throws Exception { super.returnObject(connection); } }
public void returnJedisInstance(Jedis jedis) { if (jedis == null) { return; } //pool.returnResource(jedis); try { goPool.returnObject(jedis); } catch (Exception e) { LOGGER.warning("REDISCONN: RETURN: " + e); } }
private void returnObject(Integer poolObject) { try { _connectionPool.returnObject(poolObject); } catch (Exception e) { throw new IllegalStateException("Could not return pool object", e); } }
public void returnJedisInstance(Jedis jedis) { if (jedis == null) { return; } //pool.returnResource(jedis); try { goPool.returnObject(jedis); } catch (Exception e) { LOGGER.warning("REDISCONN: RETURN: " + e); } }
public void put(Parser parser) { try { pool.returnObject(parser); } catch (Exception e) { throw new RuntimeException("Error returning a parser to the pool", e); } }
public void returnObject(final T engine) { notNull(engine); try { objectPool.returnObject(engine); } catch (final Exception e) { // should never happen throw new RuntimeException("Cannot get object from the pool", e); } }
public void returnObject(final T engine) { notNull(engine); try { objectPool.returnObject(engine); } catch (final Exception e) { // should never happen throw new RuntimeException("Cannot get object from the pool", e); } }
protected void returnTimerTaskHandle(TimerTaskHandle timerTaskHandle) { try { pool.returnObject(timerTaskHandle); } catch (Exception e) { logger.warn(e.getMessage()); } }
private void returnToPool(Object obj, Map<Class<?>, GenericObjectPool> pools) { try { GenericObjectPool pool = pools.get(obj.getClass()); if (pool == null) { throw new IllegalStateException("Received unexpected compressor or decompressor, " + "cannot be returned to any available pool: " + obj.getClass().getSimpleName()); } pool.returnObject(obj); } catch (Exception e) { throw new ParquetCompressionCodecException(e); } }
/** * 返回对象到池中 * * @param resource */ public void returnResourceObject(final Object resource) { try { internalPool.returnObject(resource); } catch (Exception e) { throw new PbrpcException("Could not return the resource to the pool", e); } }
/** * 返回对象到池中 * * @param resource */ public void returnResourceObject(final Object resource) { try { internalPool.returnObject(resource); } catch (Exception e) { throw new PbrpcException("Could not return the resource to the pool", e); } }
public void returnLease(JdbcCompiledQueryLease lease) { if (logger.isDebugEnabled()) { logger.debug("Returning lease. Leases (before): Active={}, Idle={}", getActiveLeases(), getIdleLeases()); } try { _pool.returnObject(lease); } catch (Exception e) { throw handleError(e, "return lease"); } }
public void returnLease(JdbcCompiledQueryLease lease) { if (logger.isDebugEnabled()) { logger.debug("Returning lease. Leases (before): Active={}, Idle={}", getActiveLeases(), getIdleLeases()); } try { _pool.returnObject(lease); } catch (Exception e) { throw handleError(e, "return lease"); } }
@Override public List<String> getActionableResourcesForAlias(String alias, String appId) throws Exception { EntitlementServiceStub stub = null; try { stub = getEntitlementStub(serverUrl); return getResources(getEntitledAttributes(alias, null, ProxyConstants.SUBJECT_ID, null, true, stub)); } finally { if (stub != null) { stub._getServiceClient().cleanupTransport(); serviceStubPool.returnObject(stub); } } }