From 61ef5a89304054f0339c7fc81ba9789ed7fe7929 Mon Sep 17 00:00:00 2001 From: Seungrae Date: Thu, 23 May 2024 02:00:47 +0900 Subject: [PATCH] Document using ThreadLocal#remove instead of ThreadLocal#set(null) See gh-32874 --- .../modules/ROOT/pages/core/aop-api/targetsource.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework-docs/modules/ROOT/pages/core/aop-api/targetsource.adoc b/framework-docs/modules/ROOT/pages/core/aop-api/targetsource.adoc index 5fd0299a4d0..71cb2799757 100644 --- a/framework-docs/modules/ROOT/pages/core/aop-api/targetsource.adoc +++ b/framework-docs/modules/ROOT/pages/core/aop-api/targetsource.adoc @@ -222,7 +222,7 @@ incorrectly using them in multi-threaded and multi-classloader environments. You should always consider wrapping a `ThreadLocal` in some other class and never directly use the `ThreadLocal` itself (except in the wrapper class). Also, you should always remember to correctly set and unset (where the latter simply involves a call to -`ThreadLocal.set(null)`) the resource local to the thread. Unsetting should be done in +`ThreadLocal.remove()`) the resource local to the thread. Unsetting should be done in any case, since not unsetting it might result in problematic behavior. Spring's `ThreadLocal` support does this for you and should always be considered in favor of using `ThreadLocal` instances without other proper handling code.