Creating Thread in AccessController.doPrivileged()

Zhong Yu zhong.j.yu at
Thu Apr 24 05:06:30 UTC 2014

If a thread is created inside AccessController.doPrivileged(), it
seems to inherit AccessControlContext from the calling thread, is that
the expected/specified behavior?

I'm asking because I tried to solve this problem: A spawned Thread
contains strong references to all call stack class loaders through
Thread.inheritedAccessControlContext. I try to avoid that and make
sure that only the immediate caller class loader is referenced; my
concern is rather garbage collection than permissions. Is there anyway
to achieve that?

Zhong Yu

More information about the core-libs-dev mailing list