diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/serialization/ClassHolder.java b/dubbo-common/src/main/java/org/apache/dubbo/common/serialization/ClassHolder.java index adb34ad5656..4dd61511e4c 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/serialization/ClassHolder.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/serialization/ClassHolder.java @@ -1,19 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.dubbo.common.serialization; import org.apache.dubbo.common.utils.ConcurrentHashSet; -import java.util.ArrayList; -import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CopyOnWriteArrayList; public class ClassHolder { private final Map>> classCache = new ConcurrentHashMap<>(); public void storeClass(Class clazz) { - classCache.computeIfAbsent(clazz.getName(), k -> new ConcurrentHashSet<>()).add(clazz); + classCache + .computeIfAbsent(clazz.getName(), k -> new ConcurrentHashSet<>()) + .add(clazz); } public Class loadClass(String className, ClassLoader classLoader) { diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/DefaultSerializeClassChecker.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/DefaultSerializeClassChecker.java index c736068c888..029f654abd2 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/DefaultSerializeClassChecker.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/DefaultSerializeClassChecker.java @@ -50,7 +50,8 @@ public class DefaultSerializeClassChecker implements AllowClassNotifyListener { public DefaultSerializeClassChecker(FrameworkModel frameworkModel) { serializeSecurityManager = frameworkModel.getBeanFactory().getOrRegisterBean(SerializeSecurityManager.class); serializeSecurityManager.registerListener(this); - classHolder = NativeDetector.inNativeImage() ? frameworkModel.getBeanFactory().getBean(ClassHolder.class) : null; + classHolder = + NativeDetector.inNativeImage() ? frameworkModel.getBeanFactory().getBean(ClassHolder.class) : null; } @Override diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/SerializeSecurityConfigurator.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/SerializeSecurityConfigurator.java index b7e8b3ff2d1..ea80a698a68 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/SerializeSecurityConfigurator.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/SerializeSecurityConfigurator.java @@ -66,7 +66,8 @@ public SerializeSecurityConfigurator(ModuleModel moduleModel) { FrameworkModel frameworkModel = moduleModel.getApplicationModel().getFrameworkModel(); serializeSecurityManager = frameworkModel.getBeanFactory().getBean(SerializeSecurityManager.class); - classHolder = NativeDetector.inNativeImage() ? frameworkModel.getBeanFactory().getBean(ClassHolder.class) : null; + classHolder = + NativeDetector.inNativeImage() ? frameworkModel.getBeanFactory().getBean(ClassHolder.class) : null; refreshStatus(); refreshCheck();