From 6f1d0fce8fbef72e4fd9e1674a01c462271e83ea Mon Sep 17 00:00:00 2001 From: kimi Date: Thu, 19 Apr 2012 07:57:35 +0000 Subject: [PATCH] =?UTF-8?q?DUBBO-342=20=E6=94=B9=E8=BF=9B=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=20hash=20code=20=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://code.alibabatech.com/svn/dubbo/trunk@1583 1a56cb94-b969-4eaa-88fa-be21384802f2 --- .../java/com/alibaba/dubbo/common/utils/PojoUtils.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/PojoUtils.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/PojoUtils.java index 81310dbba..34cc23b55 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/PojoUtils.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/PojoUtils.java @@ -110,7 +110,7 @@ public class PojoUtils { return ((Class)pojo).getName(); } - Integer id = System.identityHashCode(pojo); + Integer id = hashCode(pojo); if (history.containsKey(id)) { return history.get(id); } @@ -227,7 +227,7 @@ public class PojoUtils { private static Object realize1(Object pojo, Class type, final Map history) { return realize0(pojo, type, null , history); } - + @SuppressWarnings({ "unchecked", "rawtypes" }) private static Object realize0(Object pojo, Class type, Type genericType, final Map history) { if (pojo == null) { @@ -473,4 +473,7 @@ public class PojoUtils { && ! Map.class.isAssignableFrom(cls); } + private static int hashCode(Object object) { + return 31 * (object.getClass().getName().hashCode() ^ System.identityHashCode(object)); + } } \ No newline at end of file -- GitLab