Details
-
Bug
-
Status: Resolved
-
Critical
-
Resolution: Fixed
-
0.5
-
None
-
None
Description
ClassDeactivationUtils statically holds two maps (classDeactivatorMap, activationStatusCache) one having a classloader as key and the other a class. These entries are never removed resulting in leaks of the TCCL or the classloaders of Deactivatable classes if they do not equal the classloader loading deltaspike.
Suggested fix:
/** * This Map holds the ClassLoader as first level to make it possible to have different configurations per * WebApplication in an EAR or other Multi-ClassLoader scenario. * * The Map then contains a List of {@link ClassDeactivator}s in order of their configured ordinal. */ private static Map<ClassLoader, List<ClassDeactivator>> classDeactivatorMap = Collections.synchronizedMap(new WeakHashMap<ClassLoader, List<ClassDeactivator>>()); /** * Cache for the result. It won't contain many classes but it might be accessed frequently. * Valid entries are only true or false. If an entry isn't available or null, it gets calculated. */ private static Map<Class<? extends Deactivatable>, Boolean> activationStatusCache = Collections.synchronizedMap(new WeakHashMap<Class<? extends Deactivatable>, Boolean>());