1 package org.openejb.util; 2 3 import java.util.HashMap ; 4 5 14 public class HashThreadLocal { 15 HashMap keyMap = new HashMap (); 16 public synchronized void put(Object key, Object value){ 17 FastThreadLocal threadLocal = (FastThreadLocal)keyMap.get(key); 18 if(threadLocal==null){ 19 threadLocal = new FastThreadLocal(); 20 keyMap.put(key, threadLocal); 21 } 22 threadLocal.set(value); 23 } 24 public synchronized Object get(Object key){ 25 FastThreadLocal threadLocal = (FastThreadLocal)keyMap.get(key); 26 if(threadLocal==null)return null; 27 return threadLocal.get(); 28 } 29 } | Popular Tags |