Creating Thread in AccessController.doPrivileged()

Zhong Yu zhong.j.yu at gmail.com
Thu Apr 24 06:53:29 UTC 2014


On Thu, Apr 24, 2014 at 12:06 AM, Zhong Yu <zhong.j.yu at gmail.com> wrote:
> If a thread is created inside AccessController.doPrivileged(), it
> seems to inherit AccessControlContext from the calling thread,

sorry, I was mistaken; there is no such inheritance, the new thread is
indeed privileged.

> 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?
>
> Thanks,
> Zhong Yu



More information about the core-libs-dev mailing list