|
|
|
|
|
|
|
|
private Map<String,Class<?>> inProgressResolutionClasses = new HashMap<String,Class<?>>(); |
|
|
private Map<String,Class<?>> inProgressResolutionClasses = new HashMap<String,Class<?>>(); |
|
|
|
|
|
|
|
|
public static ReflectionWorld getReflectionWorldFor(WeakClassLoaderReference classLoaderReference) { |
|
|
public static ReflectionWorld getReflectionWorldFor(WeakClassLoaderReference classLoaderReference) { |
|
|
synchronized (rworlds) { |
|
|
|
|
|
// Tidyup any no longer relevant entries... |
|
|
|
|
|
for (Iterator<Map.Entry<WeakClassLoaderReference, ReflectionWorld>> it = rworlds.entrySet().iterator(); |
|
|
|
|
|
it.hasNext();) { |
|
|
|
|
|
Map.Entry<WeakClassLoaderReference, ReflectionWorld> entry = it.next(); |
|
|
|
|
|
if (entry.getKey().getClassLoader() == null) { |
|
|
|
|
|
it.remove(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
ReflectionWorld rworld = null; |
|
|
|
|
|
if (classLoaderReference.getClassLoader() != null) { |
|
|
|
|
|
rworld = rworlds.get(classLoaderReference); |
|
|
|
|
|
if (rworld == null) { |
|
|
|
|
|
rworld = new ReflectionWorld(classLoaderReference); |
|
|
|
|
|
rworlds.put(classLoaderReference, rworld); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return rworld; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return new ReflectionWorld(classLoaderReference); |
|
|
|
|
|
// synchronized (rworlds) { |
|
|
|
|
|
// // Tidyup any no longer relevant entries... |
|
|
|
|
|
// for (Iterator<Map.Entry<WeakClassLoaderReference, ReflectionWorld>> it = rworlds.entrySet().iterator(); |
|
|
|
|
|
// it.hasNext();) { |
|
|
|
|
|
// Map.Entry<WeakClassLoaderReference, ReflectionWorld> entry = it.next(); |
|
|
|
|
|
// if (entry.getKey().getClassLoader() == null) { |
|
|
|
|
|
// it.remove(); |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// ReflectionWorld rworld = null; |
|
|
|
|
|
// if (classLoaderReference.getClassLoader() != null) { |
|
|
|
|
|
// rworld = rworlds.get(classLoaderReference); |
|
|
|
|
|
// if (rworld == null) { |
|
|
|
|
|
// rworld = new ReflectionWorld(classLoaderReference); |
|
|
|
|
|
// rworlds.put(classLoaderReference, rworld); |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// return rworld; |
|
|
|
|
|
// } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static void cleanUpWorlds() { |
|
|
public static void cleanUpWorlds() { |