JreMemoryLeakPreventionListener intentionally invokes methods known to pin the context ClassLoader in memory in order to avoid having a WebappClassLoader unintentionally pin itself. This may cause undesirable behavior in embedded environments. Instead, JMLPL could use a security context to temporarily set the current context ClassLoader to be the system ClassLoader and solve the embedded situation without the client having to remember to take this care.
Created attachment 26260 [details] Patch to add tccl push/pop around speculative ClassLoader pinning. Patch to add tccl push/pop around speculative ClassLoader pinning. Patch does not include /lots/ of re-indentation required by a newly-added try/catch block surrounding everything.
Nice idea and thanks for the patch. It has been applied to 7.0.x and will be included in 7.0.5 onwards.
Fixed in 6.0.x and will be included in 6.0.30 onwards.