Skip to content

Commit

Permalink
Fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbumenJ committed Mar 22, 2024
1 parent 721a467 commit 13a5884
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -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<String, Set<Class<?>>> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 13a5884

Please sign in to comment.