[ 
https://issues.apache.org/jira/browse/DELTASPIKE-519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13894475#comment-13894475
 ] 

Romain Manni-Bucau commented on DELTASPIKE-519:
-----------------------------------------------

I think we have it for BeanManagerProvider too. We spoke about having a map 
store in the classloader (using Unsafe), it could do the trick and would avoid 
the need to track classloaders

> ClassLoader leak in ClassDeactivationUtils
> ------------------------------------------
>
>                 Key: DELTASPIKE-519
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-519
>             Project: DeltaSpike
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 0.5
>            Reporter: Moritz Bechler
>            Priority: Critical
>
> 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:
> {code}
> /**
>      * 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>());
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to