sclass FlexThreadLocal extends BetterThreadLocal { static Map motherThreads = weakMap(); public A get() { ret get(grandMotherThread()); } void set(A a) { map.put(grandMotherThread(), a); } static Thread grandMotherThread(Thread t default currentThread()) { ret applyWhileNotNull motherThread(t); } static void setMotherThread(Thread t) { mapPutOrRemove(motherThreads, currentThread(), grandMotherThread(t)); } static Thread motherThread(Thread t default currentThread()) { ret mapGet(motherThreads, t); } }