Java tutorial
//package com.java2s; import java.util.HashMap; import java.util.Map; public class Main { static Map THREAD_LOCAL_MAP = new HashMap(); public synchronized static void remove(String key) { ThreadLocal tl = (ThreadLocal) THREAD_LOCAL_MAP.get(key); if (tl != null) { tl.remove(); } } public static Object get(String key) { ThreadLocal tl = (ThreadLocal) THREAD_LOCAL_MAP.get(key); if (tl == null) return null; return tl.get(); } }