1 61 62 package org.apache.commons.discovery.tools; 63 64 import java.util.HashMap ; 65 66 import org.apache.commons.discovery.jdk.JDKHooks; 67 68 69 88 public class EnvironmentCache { 89 96 private static final HashMap root_cache = new HashMap (); 97 98 101 public static final int smallHashSize = 13; 102 103 106 public static synchronized Object get(ClassLoader classLoader) 107 { 108 112 return root_cache.get(classLoader); 113 } 114 115 118 public static synchronized void put(ClassLoader classLoader, Object object) 119 { 120 124 if (object != null) { 125 root_cache.put(classLoader, object); 126 } 127 } 128 129 130 131 132 143 public static synchronized void release() { 144 148 root_cache.remove(JDKHooks.getJDKHooks().getThreadContextClassLoader()); 149 } 150 151 152 158 public static synchronized void release(ClassLoader classLoader) { 159 163 root_cache.remove(classLoader); 164 } 165 } 166 | Popular Tags |