Browse Source

Made threadlocals generic

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@592 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
Arjen Poutsma 17 years ago
parent
commit
c91ea61ed1
  1. 10
      org.springframework.web/src/main/java/org/springframework/web/context/request/RequestContextHolder.java

10
org.springframework.web/src/main/java/org/springframework/web/context/request/RequestContextHolder.java

@ -46,10 +46,10 @@ public abstract class RequestContextHolder { @@ -46,10 +46,10 @@ public abstract class RequestContextHolder {
private static final boolean jsfPresent =
ClassUtils.isPresent("javax.faces.context.FacesContext", RequestContextHolder.class.getClassLoader());
private static final ThreadLocal requestAttributesHolder = new NamedThreadLocal("Request attributes");
private static final ThreadLocal<RequestAttributes> requestAttributesHolder = new NamedThreadLocal<RequestAttributes>("Request attributes");
private static final ThreadLocal inheritableRequestAttributesHolder =
new NamedInheritableThreadLocal("Request context");
private static final ThreadLocal<RequestAttributes> inheritableRequestAttributesHolder =
new NamedInheritableThreadLocal<RequestAttributes>("Request context");
/**
@ -93,9 +93,9 @@ public abstract class RequestContextHolder { @@ -93,9 +93,9 @@ public abstract class RequestContextHolder {
* or <code>null</code> if none bound
*/
public static RequestAttributes getRequestAttributes() {
RequestAttributes attributes = (RequestAttributes) requestAttributesHolder.get();
RequestAttributes attributes = requestAttributesHolder.get();
if (attributes == null) {
attributes = (RequestAttributes) inheritableRequestAttributesHolder.get();
attributes = inheritableRequestAttributesHolder.get();
}
return attributes;
}

Loading…
Cancel
Save