Java tutorial
//package com.java2s; import java.util.Map; public class Main { private static ThreadLocal<Map<String, Object>> threadLocal = new ThreadLocal<Map<String, Object>>(); private static final String BASEPATH_KEY = "basepath"; /** * @return */ public static String getBasePath() { Map<String, Object> map = threadLocal.get(); if (map == null) { return null; } Object o = map.get(BASEPATH_KEY); return o == null ? null : o.toString(); } }