Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow creating synchronized pool CommonsPoolTargetSource [SPR-8382] #13029

Closed
spring-issuemaster opened this issue May 30, 2011 · 1 comment

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented May 30, 2011

Tomasz Nurkiewicz opened SPR-8382 and commented

Some object factories aren't thread-safe and thus do not allow calling org.apache.commons.pool.PoolableObjectFactory#makeObject from within multiple threads. Commons-pool library provides convenient PoolUtils#synchronizedPool method to synchronize such factories. I can take advantage of this method by simply extending org.springframework.aop.target.CommonsPoolTargetSource:

public class SynchCommonsPoolTargetSource extends CommonsPoolTargetSource {

	@Override
	protected ObjectPool createObjectPool() {
		return PoolUtils.synchronizedPool(super.createObjectPool());
	}

}

However it would be nice if CommonsPoolTargetSource itself had an option to synchronize the pool if required. Implementation is pretty straightforward (in org.springframework.aop.target.CommonsPoolTargetSource#createObjectPool):

return synchronizedPool? PoolUtils.synchronizedPool(gop) : gop;

where synchronizedPool would be accessible as factory property (field+setter).


Affects: 3.0.5

1 votes, 2 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jan 12, 2019

Bulk closing outdated, unresolved issues. Please, reopen if still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.