Those are one of the worst leaks... but any leak is evil. So, I, personally, resolve them. Profiling helps as well.
There are no easy ways per se but:
- Threads go into threadGroups +starter thread for each module to ensure new Threads() have that group.
- Special care of the Thread.inheritedAccessControlContext (which holds a reference to the classloader)
- WeakReferences when you need to keep classes, actually use WeakReferences for listeners, so no one can skip de-registers (and use only annon. clasess). Having the framework for WeakListeners does help.
- Extra care for DB drives, java.security.Provider
- few more tricks (incl. dynamic enhance of class files but that's overkill usually)
bottom line:
leaks are evil.