From f6334fc62b4eabd9ef3975f556def0db82852efb Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Sat, 2 Jul 2016 15:17:34 +0200 Subject: [PATCH] Aligned default Map capacity --- .../AbstractMethodMessageHandler.java | 54 ++++++++++--------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java index d9a1f52c5c..004d25ed11 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java @@ -83,6 +83,8 @@ public abstract class AbstractMethodMessageHandler protected final Log logger = LogFactory.getLog(getClass()); + private Collection destinationPrefixes = new ArrayList(); + private final List customArgumentResolvers = new ArrayList(4); @@ -95,9 +97,11 @@ public abstract class AbstractMethodMessageHandler private final HandlerMethodReturnValueHandlerComposite returnValueHandlers = new HandlerMethodReturnValueHandlerComposite(); - private final Map handlerMethods = new LinkedHashMap(); + private ApplicationContext applicationContext; - private final MultiValueMap destinationLookup = new LinkedMultiValueMap(); + private final Map handlerMethods = new LinkedHashMap(64); + + private final MultiValueMap destinationLookup = new LinkedMultiValueMap(64); private final Map, AbstractExceptionHandlerMethodResolver> exceptionHandlerCache = new ConcurrentHashMap, AbstractExceptionHandlerMethodResolver>(64); @@ -105,16 +109,6 @@ public abstract class AbstractMethodMessageHandler private final Map exceptionHandlerAdviceCache = new LinkedHashMap(64); - private Collection destinationPrefixes = new ArrayList(); - - private ApplicationContext applicationContext; - - /** - * Return the configured destination prefixes. - */ - public Collection getDestinationPrefixes() { - return this.destinationPrefixes; - } /** * When this property is configured only messages to destinations matching @@ -135,10 +129,10 @@ public abstract class AbstractMethodMessageHandler } /** - * Return the configured custom argument resolvers, if any. + * Return the configured destination prefixes, if any. */ - public List getCustomArgumentResolvers() { - return this.customArgumentResolvers; + public Collection getDestinationPrefixes() { + return this.destinationPrefixes; } /** @@ -153,10 +147,10 @@ public abstract class AbstractMethodMessageHandler } /** - * Return the configured custom return value handlers, if any. + * Return the configured custom argument resolvers, if any. */ - public List getCustomReturnValueHandlers() { - return this.customReturnValueHandlers; + public List getCustomArgumentResolvers() { + return this.customArgumentResolvers; } /** @@ -171,10 +165,10 @@ public abstract class AbstractMethodMessageHandler } /** - * Return the complete list of argument resolvers. + * Return the configured custom return value handlers, if any. */ - public List getArgumentResolvers() { - return this.argumentResolvers.getResolvers(); + public List getCustomReturnValueHandlers() { + return this.customReturnValueHandlers; } /** @@ -191,10 +185,10 @@ public abstract class AbstractMethodMessageHandler } /** - * Return the complete list of return value handlers. + * Return the complete list of argument resolvers. */ - public List getReturnValueHandlers() { - return this.returnValueHandlers.getReturnValueHandlers(); + public List getArgumentResolvers() { + return this.argumentResolvers.getResolvers(); } /** @@ -210,8 +204,11 @@ public abstract class AbstractMethodMessageHandler this.returnValueHandlers.addHandlers(returnValueHandlers); } - public ApplicationContext getApplicationContext() { - return this.applicationContext; + /** + * Return the complete list of return value handlers. + */ + public List getReturnValueHandlers() { + return this.returnValueHandlers.getReturnValueHandlers(); } @Override @@ -219,6 +216,11 @@ public abstract class AbstractMethodMessageHandler this.applicationContext = applicationContext; } + public ApplicationContext getApplicationContext() { + return this.applicationContext; + } + + @Override public void afterPropertiesSet() { if (this.argumentResolvers.getResolvers().isEmpty()) {