Java Code Examples for org.springframework.aop.target.CommonsPool2TargetSource#setMaxSize()

The following examples show how to use org.springframework.aop.target.CommonsPool2TargetSource#setMaxSize() . 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: QuickTargetSourceCreator.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Override
@Nullable
protected final AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(
		Class<?> beanClass, String beanName) {

	if (beanName.startsWith(PREFIX_COMMONS_POOL)) {
		CommonsPool2TargetSource cpts = new CommonsPool2TargetSource();
		cpts.setMaxSize(25);
		return cpts;
	}
	else if (beanName.startsWith(PREFIX_THREAD_LOCAL)) {
		return new ThreadLocalTargetSource();
	}
	else if (beanName.startsWith(PREFIX_PROTOTYPE)) {
		return new PrototypeTargetSource();
	}
	else {
		// No match. Don't create a custom target source.
		return null;
	}
}
 
Example 2
Source File: QuickTargetSourceCreator.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected final AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(
		Class<?> beanClass, String beanName) {

	if (beanName.startsWith(PREFIX_COMMONS_POOL)) {
		CommonsPool2TargetSource cpts = new CommonsPool2TargetSource();
		cpts.setMaxSize(25);
		return cpts;
	}
	else if (beanName.startsWith(PREFIX_THREAD_LOCAL)) {
		return new ThreadLocalTargetSource();
	}
	else if (beanName.startsWith(PREFIX_PROTOTYPE)) {
		return new PrototypeTargetSource();
	}
	else {
		// No match. Don't create a custom target source.
		return null;
	}
}
 
Example 3
Source File: Spr15042Tests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Bean
public CommonsPool2TargetSource poolTargetSource() {
	CommonsPool2TargetSource pool = new CommonsPool2TargetSource();
	pool.setMaxSize(3);
	pool.setTargetBeanName("myObjectTarget");
	return pool;
}
 
Example 4
Source File: Spr15042Tests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Bean
public CommonsPool2TargetSource poolTargetSource() {
	CommonsPool2TargetSource pool = new CommonsPool2TargetSource();
	pool.setMaxSize(3);
	pool.setTargetBeanName("myObjectTarget");
	return pool;
}