public class ThreadLocalProxy<T> extends ThreadLocal<T>
| Constructor and Description |
|---|
ThreadLocalProxy() |
ThreadLocalProxy(@NotNull ThreadLocal<T> tl) |
| Modifier and Type | Method and Description |
|---|---|
T |
get() |
@NotNull ThreadLocal<T> |
getBackend() |
void |
remove() |
@NotNull ThreadLocal<T> |
replaceBackend(@NotNull ThreadLocal<T> threadLocal,
boolean tryToCleanOld)
change the internal ThreadLocal impl, return the old value.
|
void |
set(T value) |
static void |
tryClear(ThreadLocal<?> threadLocal)
try to clear the values in threadLocal by reflection.
|
initialValue, withInitialpublic ThreadLocalProxy()
public ThreadLocalProxy(@NotNull
@NotNull ThreadLocal<T> tl)
public static void tryClear(ThreadLocal<?> threadLocal) throws ThreadLocalAttention
ThreadLocalAttention@NotNull public @NotNull ThreadLocal<T> getBackend()
@NotNull public @NotNull ThreadLocal<T> replaceBackend(@NotNull @NotNull ThreadLocal<T> threadLocal, boolean tryToCleanOld) throws ThreadLocalAttention
change the internal ThreadLocal impl, return the old value. do NOT change it more than once. tryToCleanOld == true, will log WARNING: An illegal reflective access operation has occurred use tryToCleanOld=false if before starting any service or a few memory is in use.
ThreadLocalAttentionpublic T get()
get in class ThreadLocal<T>public void set(T value)
set in class ThreadLocal<T>public void remove()
remove in class ThreadLocal<T>Copyright © 2023. All rights reserved.