private static Pair<ConnectorPoolKey, ObjectPool<PoolableConnector>> getPool2( final APIConfigurationImpl impl, final LocalConnectorInfoImpl localInfo) throws InstantiationException, IllegalAccessException { // determine if this connector wants generic connector pooling.. if (impl.isConnectorPoolingSupported()) { ConnectorPoolKey key = new ConnectorPoolKey(impl.getConnectorInfo().getConnectorKey(), impl .getConfigurationProperties(), impl.getConnectorPoolConfiguration()); // get the pool associated.. ObjectPool<PoolableConnector> pool = POOLS.get(key); // create a new pool if it doesn't exist.. if (pool == null) { LOG.info("Creating new pool: {0}", impl.getConnectorInfo().getConnectorKey()); // this instance is strictly used for the pool.. pool = new ObjectPool<>( new ConnectorPoolHandler(impl, localInfo), impl.getConnectorPoolConfiguration()); // add back to the map of POOLS.. ObjectPool<PoolableConnector> previousPool = POOLS.putIfAbsent(key, pool); // Use the pool made by other thread if (previousPool != null) { pool = previousPool; } } return Pair.of(key, pool); } else if (!localInfo.isConfigurationStateless()) { return Pair.of(new ConnectorPoolKey(impl.getConnectorInfo().getConnectorKey(), impl .getConfigurationProperties(), impl.getConnectorPoolConfiguration()), null); } return Pair.of(null, null); }
private static Pair<ConnectorPoolKey, ObjectPool<PoolableConnector>> getPool2( final APIConfigurationImpl impl, final LocalConnectorInfoImpl localInfo) throws InstantiationException, IllegalAccessException { // determine if this connector wants generic connector pooling.. if (impl.isConnectorPoolingSupported()) { ConnectorPoolKey key = new ConnectorPoolKey(impl.getConnectorInfo().getConnectorKey(), impl .getConfigurationProperties(), impl.getConnectorPoolConfiguration()); // get the pool associated.. ObjectPool<PoolableConnector> pool = POOLS.get(key); // create a new pool if it doesn't exist.. if (pool == null) { LOG.info("Creating new pool: {0}", impl.getConnectorInfo().getConnectorKey()); // this instance is strictly used for the pool.. pool = new ObjectPool<>( new ConnectorPoolHandler(impl, localInfo), impl.getConnectorPoolConfiguration()); // add back to the map of POOLS.. ObjectPool<PoolableConnector> previousPool = POOLS.putIfAbsent(key, pool); // Use the pool made by other thread if (previousPool != null) { pool = previousPool; } } return Pair.of(key, pool); } else if (!localInfo.isConfigurationStateless()) { return Pair.of(new ConnectorPoolKey(impl.getConnectorInfo().getConnectorKey(), impl .getConfigurationProperties(), impl.getConnectorPoolConfiguration()), null); } return Pair.of(null, null); }