Skip to content

Commit f6334fc

Browse files
committed
Aligned default Map capacity
1 parent c6752e6 commit f6334fc

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ public abstract class AbstractMethodMessageHandler<T>
8383

8484
protected final Log logger = LogFactory.getLog(getClass());
8585

86+
private Collection<String> destinationPrefixes = new ArrayList<String>();
87+
8688
private final List<HandlerMethodArgumentResolver> customArgumentResolvers =
8789
new ArrayList<HandlerMethodArgumentResolver>(4);
8890

@@ -95,26 +97,18 @@ public abstract class AbstractMethodMessageHandler<T>
9597
private final HandlerMethodReturnValueHandlerComposite returnValueHandlers =
9698
new HandlerMethodReturnValueHandlerComposite();
9799

98-
private final Map<T, HandlerMethod> handlerMethods = new LinkedHashMap<T, HandlerMethod>();
100+
private ApplicationContext applicationContext;
101+
102+
private final Map<T, HandlerMethod> handlerMethods = new LinkedHashMap<T, HandlerMethod>(64);
99103

100-
private final MultiValueMap<String, T> destinationLookup = new LinkedMultiValueMap<String, T>();
104+
private final MultiValueMap<String, T> destinationLookup = new LinkedMultiValueMap<String, T>(64);
101105

102106
private final Map<Class<?>, AbstractExceptionHandlerMethodResolver> exceptionHandlerCache =
103107
new ConcurrentHashMap<Class<?>, AbstractExceptionHandlerMethodResolver>(64);
104108

105109
private final Map<MessagingAdviceBean, AbstractExceptionHandlerMethodResolver> exceptionHandlerAdviceCache =
106110
new LinkedHashMap<MessagingAdviceBean, AbstractExceptionHandlerMethodResolver>(64);
107111

108-
private Collection<String> destinationPrefixes = new ArrayList<String>();
109-
110-
private ApplicationContext applicationContext;
111-
112-
/**
113-
* Return the configured destination prefixes.
114-
*/
115-
public Collection<String> getDestinationPrefixes() {
116-
return this.destinationPrefixes;
117-
}
118112

119113
/**
120114
* When this property is configured only messages to destinations matching
@@ -135,10 +129,10 @@ public void setDestinationPrefixes(Collection<String> prefixes) {
135129
}
136130

137131
/**
138-
* Return the configured custom argument resolvers, if any.
132+
* Return the configured destination prefixes, if any.
139133
*/
140-
public List<HandlerMethodArgumentResolver> getCustomArgumentResolvers() {
141-
return this.customArgumentResolvers;
134+
public Collection<String> getDestinationPrefixes() {
135+
return this.destinationPrefixes;
142136
}
143137

144138
/**
@@ -153,10 +147,10 @@ public void setCustomArgumentResolvers(List<HandlerMethodArgumentResolver> custo
153147
}
154148

155149
/**
156-
* Return the configured custom return value handlers, if any.
150+
* Return the configured custom argument resolvers, if any.
157151
*/
158-
public List<HandlerMethodReturnValueHandler> getCustomReturnValueHandlers() {
159-
return this.customReturnValueHandlers;
152+
public List<HandlerMethodArgumentResolver> getCustomArgumentResolvers() {
153+
return this.customArgumentResolvers;
160154
}
161155

162156
/**
@@ -171,10 +165,10 @@ public void setCustomReturnValueHandlers(List<HandlerMethodReturnValueHandler> c
171165
}
172166

173167
/**
174-
* Return the complete list of argument resolvers.
168+
* Return the configured custom return value handlers, if any.
175169
*/
176-
public List<HandlerMethodArgumentResolver> getArgumentResolvers() {
177-
return this.argumentResolvers.getResolvers();
170+
public List<HandlerMethodReturnValueHandler> getCustomReturnValueHandlers() {
171+
return this.customReturnValueHandlers;
178172
}
179173

180174
/**
@@ -191,10 +185,10 @@ public void setArgumentResolvers(List<HandlerMethodArgumentResolver> argumentRes
191185
}
192186

193187
/**
194-
* Return the complete list of return value handlers.
188+
* Return the complete list of argument resolvers.
195189
*/
196-
public List<HandlerMethodReturnValueHandler> getReturnValueHandlers() {
197-
return this.returnValueHandlers.getReturnValueHandlers();
190+
public List<HandlerMethodArgumentResolver> getArgumentResolvers() {
191+
return this.argumentResolvers.getResolvers();
198192
}
199193

200194
/**
@@ -210,15 +204,23 @@ public void setReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnV
210204
this.returnValueHandlers.addHandlers(returnValueHandlers);
211205
}
212206

213-
public ApplicationContext getApplicationContext() {
214-
return this.applicationContext;
207+
/**
208+
* Return the complete list of return value handlers.
209+
*/
210+
public List<HandlerMethodReturnValueHandler> getReturnValueHandlers() {
211+
return this.returnValueHandlers.getReturnValueHandlers();
215212
}
216213

217214
@Override
218215
public void setApplicationContext(ApplicationContext applicationContext) {
219216
this.applicationContext = applicationContext;
220217
}
221218

219+
public ApplicationContext getApplicationContext() {
220+
return this.applicationContext;
221+
}
222+
223+
222224
@Override
223225
public void afterPropertiesSet() {
224226
if (this.argumentResolvers.getResolvers().isEmpty()) {

0 commit comments

Comments
 (0)