InheritableThreadLocals may leak memory when redeploying

I noticed that our application is using more and more memory as we redeploy it frequently. I analyzed the memory usage with yourkit and found the following problem:

We trigger asynchronous methods on an ejb. These asynchronous methods run on an ejb thread belonging to a thread pool. This means the threads live on even after the method has been executed. These threads inherit the inheritable ThreadLocals from CurrentInstance. This leads to Classes and Classloaders staying in memory, even after undeploy.

I saw that this problem was “fixed” in which lead to But the fix for 12509 now reintroduces the initial problem.

Are there plans to change the way CurrentInstance works? If not any tips for workarounds?