<commit_before>/*
 * Copyright 2002-2005 the original author or authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.aop.target;

import org.apache.commons.pool.ObjectPool;
import org.apache.commons.pool.PoolableObjectFactory;
import org.apache.commons.pool.impl.GenericObjectPool;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.DisposableBean;

/**
 * Jakarta Commons pooling implementation extending <code>AbstractPoolingTargetSource</code>.
 * <p/>
 * By default, an instance of <code>GenericObjectPool</code> is created. Sub-classes may change the
 * type of <code>ObjectPool</code> used by overridding the <code>createObjectPool()</code> method.
 * <p/>
 * Provides many configuration properties mirroring those of the Commons Pool <code>GenericObjectPool</code> class.
 * This properties are passed to the <code>GenericObjectPool</code> during construction. If creating a sub-class of
 * this class to change the <code>ObjectPool</code> implementation type, you must remember to pass in the values of
 * configuration properties that are relevant to your chosen implementation.
 * <p/>
 * The <code>testOnBorrow</code>, <code>testOnReturn</code> and <code>testWhileIdle</code> properties are explictly not
 * mirrored because the implementation of <code>PoolableObjectFactory</code> used by this class does not implement
 * meaningful validation.
 * 
 * @author <NAME>
 * @author <NAME>
 * @see GenericObjectPool
 * @see #createObjectPool()
 * @see #setMaxIdle(int)
 * @see #setMaxSize(int)
 * @see #setMaxWait(long)
 * @see #setMinEvictableIdleTimeMillis(long)
 * @see #setMinIdle(int)
 * @see #setNumTestsPerEvictionRun(int)
 * @see #setTimeBetweenEvictionRunsMillis(long)
 */
public class CommonsPoolTargetSource extends AbstractPoolingTargetSource
		implements PoolableObjectFactory {

	/**
	 * The Jakarta Commons <code>ObjectPool</code> used to pool target objects
	 */
	private ObjectPool pool;

	/**
	 * Corresponds to the <code>maxIdle</code> flag of the underlying pool object.
	 * @see GenericObjectPool#setMaxIdle(int)
	 * @see #setMinIdle(int)
	 */
	private int maxIdle;

	/**
	 * Corresponds to the <code>minIdle</code> flag of the underlying pool object.
	 * @see GenericObjectPool#setMinIdle(int)
	 * @see #setMinIdle(int)
	 */
	private int minIdle;

	/**
	 * Corresponds to the <code>maxWait</code> flag of the underlying pool object.
	 * @see GenericObjectPool#setMaxWait(long)
	 * @see #setMaxWait(long)
	 */
	private long maxWait;

	/**
	 * Corresponds to the <code>minEvictableIdleTimeMillis</code> flag of the underlying pool object.
	 * @see GenericObjectPool#setMinEvictableIdleTimeMillis(long)
	 * @see #setMinEvictableIdleTimeMillis(long)
	 */
	private long minEvictableIdleTimeMillis;

	/**
	 * Corresponds to the <code>numTestsPerEvictionRun</code> flag of the underlying pool object.
	 * @see GenericObjectPool#setNumTestsPerEvictionRun(int)
	 * @see #setNumTestsPerEvictionRun(int)
	 */
	private int numTestsPerEvictionRun;

	/**
	 * Corresponds to the <code>timeBetweenEvictionRunsMillis</code> flag of the underlying pool object.
	 * @see GenericObjectPool#setTimeBetweenEvictionRunsMillis(long)
	 * @see #setTimeBetweenEvictionRunsMillis(long)
	 */
	private long timeBetweenEvictionRunsMillis;

	/**
	 * Gets the value of the <code>maxIdle</code> property used to configure the pool object when created.
	 */
	protected int getMaxIdle() {
		return maxIdle;
	}

	/**
	 * Sets the value of the <code>maxIdle</code> property which is passed to the pool object when created.
	 * @see GenericObjectPool#setMaxIdle(int)
	 */
	public void setMaxIdle(int maxIdle) {<commit_msg>Updated CommonsPoolTargetSource so that the default values of the configuration properties mirror the defaults in GenericObjectPool<commit_after>/*
 * Copyright 2002-2005 the original author or authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.aop.target;

import org.apache.commons.pool.ObjectPool;
import org.apache.commons.pool.PoolableObjectFactory;
import org.apache.commons.pool.impl.GenericObjectPool;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.DisposableBean;

/**
 * Jakarta Commons pooling implementation extending <code>AbstractPoolingTargetSource</code>.
 * <p/>
 * By default, an instance of <code>GenericObjectPool</code> is created. Sub-classes may change the
 * type of <code>ObjectPool</code> used by overridding the <code>createObjectPool()</code> method.
 * <p/>
 * Provides many configuration properties mirroring those of the Commons Pool <code>GenericObjectPool</code> class.
 * This properties are passed to the <code>GenericObjectPool</code> during construction. If creating a sub-class of
 * this class to change the <code>ObjectPool</code> implementation type, you must remember to pass in the values of
 * configuration properties that are relevant to your chosen implementation.
 * <p/>
 * The <code>testOnBorrow</code>, <code>testOnReturn</code> and <code>testWhileIdle</code> properties are explictly not
 * mirrored because the implementation of <code>PoolableObjectFactory</code> used by this class does not implement
 * meaningful validation.
 * 
 * @author <NAME>
 * @author <NAME>
 * @see GenericObjectPool
 * @see #createObjectPool()
 * @see #setMaxIdle(int)
 * @see #setMaxSize(int)
 * @see #setMaxWait(long)
 * @see #setMinEvictableIdleTimeMillis(long)
 * @see #setMinIdle(int)
 * @see #setNumTestsPerEvictionRun(int)
 * @see #setTimeBetweenEvictionRunsMillis(long)
 */
public class CommonsPoolTargetSource extends AbstractPoolingTargetSource
		implements PoolableObjectFactory {

	/**
	 * The Jakarta Commons <code>ObjectPool</code> used to pool target objects
	 */
	private ObjectPool pool;

	/**
	 * Corresponds to the <code>maxIdle</code> flag of the underlying pool object.
	 * @see GenericObjectPool#setMaxIdle(int)
	 * @see #setMinIdle(int)
	 */
	private int maxIdle = GenericObjectPool.DEFAULT_MAX_IDLE;

	/**
	 * Corresponds to the <code>minIdle</code> flag of the underlying pool object.
	 * @see GenericObjectPool#setMinIdle(int)
	 * @see #setMinIdle(int)
	 */
	private int minIdle = GenericObjectPool.DEFAULT_MIN_IDLE;

	/**
	 * Corresponds to the <code>maxWait</code> flag of the underlying pool object.
	 * @see GenericObjectPool#setMaxWait(long)
	 * @see #setMaxWait(long)
	 */
	private long maxWait = GenericObjectPool.DEFAULT_MAX_WAIT;

	/**
	 * Corresponds to the <code>minEvictableIdleTimeMillis</code> flag of the underlying pool object.
	 * @see GenericObjectPool#setMinEvictableIdleTimeMillis(long)
	 * @see #setMinEvictableIdleTimeMillis(long)
	 */
	private long minEvictableIdleTimeMillis = GenericObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS;

	/**
	 * Corresponds to the <code>numTestsPerEvictionRun</code> flag of the underlying pool object.
	 * @see GenericObjectPool#setNumTestsPerEvictionRun(int)
	 * @see #setNumTestsPerEvictionRun(int)
	 */
	private int numTestsPerEvictionRun = GenericObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN;

	/**
	 * Corresponds to the <code>timeBetweenEvictionRunsMillis</code> flag of the underlying pool object.
	 * @see GenericObjectPool#setTimeBetweenEvictionRunsMillis(long)
	 * @see #setTimeBetweenEvictionRunsMillis(long)
	 */
	private long timeBetweenEvictionRunsMillis = GenericObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS;

	/**
	 * Gets the value of the <code>maxIdle</code> property used to configure the pool object when created.
	 */
	protected int getMaxIdle() {
		return maxIdle;
	}

	/**
	 * Sets the value of the <code>maxIdle</code> property which is passed to the pool object when created.
	 * @see GenericObjectPool#setMaxIdle(int)
	 */
	public void setMaxIdle(int maxIdle) {
{'fraction_non_alphanumeric': 0.09440520237694809, 'fraction_numerical': 0.0026908846283215607, 'mean_word_length': 5.010781671159029, 'pattern_counts': {'":': 0, '<': 93, '<?xml version=': 0, '>': 93, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '677698', 'n_tokens_mistral': 2683, 'n_tokens_neox': 2562, 'n_words': 803}