net.sf.ehcache.util.lang
Class VicariousThreadLocal<T>
java.lang.Object
   java.lang.ThreadLocal<T>
java.lang.ThreadLocal<T>
       net.sf.ehcache.util.lang.VicariousThreadLocal<T>
net.sf.ehcache.util.lang.VicariousThreadLocal<T>
- public class VicariousThreadLocal<T> 
- extends ThreadLocal<T>
A drop-in replacement ThreadLocal implementation that does not leak
 when thread-local values reference the ThreadLocal object.
 The code is optimised to cope with frequently changing values.
 
 In comparison to plain ThreadLocal, this implementation:
 - from the point of view of a single thread,
 each thread-local
 {code #get} requires access to four objects instead of two
 
- is fractionally slower in terms of CPU cycles for {code #get}
 
- uses around twice the memory for each thead-local value
 
- uses around four times the memory for each ThreadLocal
- may release thread-local values for garbage collection more promptly
 
 
| Method Summary | 
|  T | get()
 | 
|  void | poll()Check if any strong references need should be removed due to thread exit.
 | 
|  void | remove()
 | 
|  void | set(T value)
 | 
 
 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
VicariousThreadLocal
public VicariousThreadLocal()
- Creates a new VicariousThreadLocal.
 
get
public T get()
- 
- Overrides:
- getin class- ThreadLocal<T>
 
- 
 
set
public void set(T value)
- 
- Overrides:
- setin class- ThreadLocal<T>
 
- 
 
remove
public void remove()
- 
- Overrides:
- removein class- ThreadLocal<T>
 
- 
 
poll
public void poll()
- Check if any strong references need should be removed due to thread exit.
 
- 
 
Copyright 2001-2015, Terracotta, Inc.