bluegitter / xmemcached

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

KetamaMemcachedSessionLocator一致性哈希问题 #256

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
hi,dennis

在使用此客户端时发现,KetamaMemcachedSessionLocator在出现session 
close或者操作超时时,可能导致locator 
build出来的map不一致,分析原因,是InetSocketAddress的toString在��
�址解析前后值不一致导致;

建议不要用InetSocketAddress.toString的值作为ketamaSessions MAP的hash 
key。

InetSocketAddress.toString的值,在初始化时和地址解析后的值会不
一样。

jdk5说明如下:
InetSocketAddress.toString():
Constructs a string representation of this InetSocketAddress. This String is 
constructed by calling toString() on the InetAddress and concatenating the port 
number (with a colon). If the address is unresolved then the part before the 
colon will only contain the hostname.

InetAddress.toString():
Converts this IP address to a String. The string returned is of the form: 
hostname / literal IP address. If the host name is unresolved, no reverse name 
service loopup is performed. The hostname part will be represented by an empty 
string.

以上建议仅供参考。

Original issue reported on code.google.com by vampire...@gmail.com on 9 Jun 2013 at 9:46

GoogleCodeExporter commented 9 years ago
建议统一设置hosts并使用hostname。

Original comment by killme2...@gmail.com on 9 Jun 2013 at 9:57

GoogleCodeExporter commented 9 years ago
尝试解决这个问题,使用第一次链接解析出来的地址并在整��
�应用生命周期内沿用。

Original comment by killme2...@gmail.com on 19 Jul 2013 at 4:26

GoogleCodeExporter commented 9 years ago
1.4.2 is released.

Original comment by killme2...@gmail.com on 19 Jul 2013 at 6:41