Avoid resizing of fixed-size HashMap/LinkedHashMap variants
Closes gh-25349
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -66,6 +66,7 @@ import org.springframework.jmx.support.ObjectNameManager;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -301,13 +302,13 @@ public class MBeanClientInterceptor
|
||||
MBeanInfo info = server.getMBeanInfo(this.objectName);
|
||||
|
||||
MBeanAttributeInfo[] attributeInfo = info.getAttributes();
|
||||
this.allowedAttributes = new HashMap<>(attributeInfo.length);
|
||||
this.allowedAttributes = CollectionUtils.newHashMap(attributeInfo.length);
|
||||
for (MBeanAttributeInfo infoEle : attributeInfo) {
|
||||
this.allowedAttributes.put(infoEle.getName(), infoEle);
|
||||
}
|
||||
|
||||
MBeanOperationInfo[] operationInfo = info.getOperations();
|
||||
this.allowedOperations = new HashMap<>(operationInfo.length);
|
||||
this.allowedOperations = CollectionUtils.newHashMap(operationInfo.length);
|
||||
for (MBeanOperationInfo infoEle : operationInfo) {
|
||||
Class<?>[] paramTypes = JmxUtils.parameterInfoToTypes(infoEle.getSignature(), this.beanClassLoader);
|
||||
this.allowedOperations.put(new MethodCacheKey(infoEle.getName(), paramTypes), infoEle);
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
@@ -28,6 +27,7 @@ import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -126,7 +126,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI
|
||||
* @return the resolved interface mappings (with Class objects as values)
|
||||
*/
|
||||
private Map<String, Class<?>[]> resolveInterfaceMappings(Properties mappings) {
|
||||
Map<String, Class<?>[]> resolvedMappings = new HashMap<>(mappings.size());
|
||||
Map<String, Class<?>[]> resolvedMappings = CollectionUtils.newHashMap(mappings.size());
|
||||
for (Enumeration<?> en = mappings.propertyNames(); en.hasMoreElements();) {
|
||||
String beanKey = (String) en.nextElement();
|
||||
String[] classNames = StringUtils.commaDelimitedListToStringArray(mappings.getProperty(beanKey));
|
||||
|
||||
Reference in New Issue
Block a user