diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2FactoryManager.java b/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2FactoryManager.java index ac342926600..f397dbc4b00 100644 --- a/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2FactoryManager.java +++ b/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2FactoryManager.java @@ -23,6 +23,7 @@ import org.apache.dubbo.common.utils.StringUtils; import org.apache.dubbo.rpc.model.FrameworkModel; +import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; import com.alibaba.com.caucho.hessian.io.SerializerFactory; @@ -46,7 +47,7 @@ public Hessian2FactoryManager(FrameworkModel frameworkModel) { public SerializerFactory getSerializerFactory(ClassLoader classLoader) { SerializerFactory sticky = stickySerializerFactory; - if (sticky != null && sticky.getClassLoader().equals(classLoader)) { + if (sticky != null && Objects.equals(sticky.getClassLoader(), classLoader)) { return sticky; }