public class FastThreadLocal<T> extends Object
ThreadLocal
access pattern ideal for heavily used
ThreadLocals.
It is faster to use a mutable holder object and always perform ThreadLocal.get() and never use
ThreadLocal.set(), because the value is more likely to be found in the ThreadLocalMap direct hash
slot and avoid the slow path ThreadLocalMap.getEntryAfterMiss().
Important: this thread local will live in ThreadLocalMap forever, so use with care.Modifier and Type | Class and Description |
---|---|
static class |
FastThreadLocal.Holder<T> |
Constructor and Description |
---|
FastThreadLocal() |
Modifier and Type | Method and Description |
---|---|
T |
get() |
FastThreadLocal.Holder<T> |
getHolder() |
protected T |
initialValue() |
void |
set(T value) |
public T get()
public FastThreadLocal.Holder<T> getHolder()
protected T initialValue()
public void set(T value)
Copyright © 2011–2017 Glowroot contributors. All rights reserved.