Java tutorial
//package com.java2s; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; public class Main { static final List<ThreadLocal> locals = new CopyOnWriteArrayList<>(); public static void cleanThreadLocals() { for (ThreadLocal tl : locals) { tl.remove(); } } }