Java tutorial
//package com.java2s; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; public class Main { static final List<ThreadLocal> locals = new CopyOnWriteArrayList<>(); static <T> ThreadLocal<T> createThreadLocal() { ThreadLocal<T> tl = new ThreadLocal<>(); locals.add(tl); return tl; } }