nfhu / xmemcached

Automatically exported from code.google.com/p/xmemcached
Apache License 2.0
0 stars 0 forks source link

XMemcachedClientFactoryBean doesn't allow overriding of certain client properties #133

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use the XMemcachedClientFactoryBean in a Spring context to create a 
XMemcachedClient instance as described on the wiki
2. There is no way to specify opTimeout, connectionTimeout, or 
connnectionPoolSize through the bean factory or the container
3.

What is the expected output? What do you see instead?
Would be nice to be able to set these properties through the factory bean 
instead of having to set them programatically in the code after retrieving the 
bean from the Spring context.

What version of the product are you using? On what operating system?
1.3.1, Linux

Please provide any additional information below.

Original issue reported on code.google.com by noal...@gmail.com on 29 Jun 2011 at 11:15

GoogleCodeExporter commented 9 years ago
hi
Yes,i's a problem,now you can use p namespace to configure these options,for 
example

<bean name="memcachedClient"
                class="net.rubyeye.xmemcached.utils.XMemcachedClientFactoryBean" destroy-method="shutdown" p:opTimeout="5000">

Using p:opTimeout="5000" to configure opTimeout to five seconds.

Original comment by killme2...@gmail.com on 30 Jun 2011 at 1:31

GoogleCodeExporter commented 9 years ago
Thanks for the tip!  I've been using the Spring framework for years and didn't 
know about the p namespace.  However, I tried it and it doesn't work as it 
tries to set the property on the factory instead of the object returned by the 
factory:

Invalid property 'opTimeout' of bean class 
[net.rubyeye.xmemcached.utils.XMemcachedClientFactoryBean]: Bean property 
'opTimeout' is not writable or has an invalid setter method. Does the parameter 
type of the setter match the return type of the getter?

Original comment by noal...@gmail.com on 1 Jul 2011 at 7:40

GoogleCodeExporter commented 9 years ago
I am sorry,it's my mistake. p namespace could not be used in 
XMemcachedClientFactoryBean but XmemcachedClientBuilder.For example

<bean name="memcachedClient" factory-bean="memcachedClientBuilder"
factory-method="build" destroy-method="shutdown"
p:opTimeout="5000"/>

Maybe you can use XmemcachedClientBuilder instead of factory bean in 
spring,please check the Spring_Integration in wiki.

I will add setter supported to factory bean in next release.

Original comment by killme2...@gmail.com on 2 Jul 2011 at 2:11

GoogleCodeExporter commented 9 years ago
Fixed by
https://github.com/killme2008/xmemcached/commit/370ede63b96998f257b94966cf995563
805fa4df

1.3.4 will be released soon.

Original comment by killme2...@gmail.com on 5 Sep 2011 at 12:58