backported locking enhancements for @MVC processing (SPR-7703)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2011 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.
|
||||
@@ -29,6 +29,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import javax.portlet.ActionRequest;
|
||||
import javax.portlet.ActionResponse;
|
||||
import javax.portlet.ClientDataRequest;
|
||||
@@ -150,7 +151,7 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator
|
||||
private BeanExpressionContext expressionContext;
|
||||
|
||||
private final Map<Class<?>, PortletHandlerMethodResolver> methodResolverCache =
|
||||
new HashMap<Class<?>, PortletHandlerMethodResolver>();
|
||||
new ConcurrentHashMap<Class<?>, PortletHandlerMethodResolver>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -300,6 +301,7 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected ModelAndView doHandle(PortletRequest request, PortletResponse response, Object handler) throws Exception {
|
||||
ExtendedModelMap implicitModel = null;
|
||||
|
||||
@@ -391,17 +393,19 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator
|
||||
*/
|
||||
private PortletHandlerMethodResolver getMethodResolver(Object handler) {
|
||||
Class handlerClass = ClassUtils.getUserClass(handler);
|
||||
synchronized (this.methodResolverCache) {
|
||||
PortletHandlerMethodResolver resolver = this.methodResolverCache.get(handlerClass);
|
||||
if (resolver == null) {
|
||||
resolver = new PortletHandlerMethodResolver(handlerClass);
|
||||
this.methodResolverCache.put(handlerClass, resolver);
|
||||
PortletHandlerMethodResolver resolver = this.methodResolverCache.get(handlerClass);
|
||||
if (resolver == null) {
|
||||
synchronized (this.methodResolverCache) {
|
||||
resolver = this.methodResolverCache.get(handlerClass);
|
||||
if (resolver == null) {
|
||||
resolver = new PortletHandlerMethodResolver(handlerClass);
|
||||
this.methodResolverCache.put(handlerClass, resolver);
|
||||
}
|
||||
}
|
||||
return resolver;
|
||||
}
|
||||
return resolver;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Template method for creating a new PortletRequestDataBinder instance.
|
||||
* <p>The default implementation creates a standard PortletRequestDataBinder.
|
||||
@@ -413,11 +417,8 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator
|
||||
* @return the PortletRequestDataBinder instance to use
|
||||
* @throws Exception in case of invalid state or arguments
|
||||
* @see PortletRequestDataBinder#bind(javax.portlet.PortletRequest)
|
||||
* @see PortletRequestDataBinder#convertIfNecessary(Object, Class, MethodParameter)
|
||||
*/
|
||||
protected PortletRequestDataBinder createBinder(
|
||||
PortletRequest request, Object target, String objectName) throws Exception {
|
||||
|
||||
protected PortletRequestDataBinder createBinder(PortletRequest request, Object target, String objectName) throws Exception {
|
||||
return new PortletRequestDataBinder(target, objectName);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user