Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以在线程级别对不受信任的代码进行沙箱处理?
sanboxing 代码的常见答案似乎是实现一个 SecurityManager并替换默认的 SecurityManager。但这将沙箱强加在 JVM 级别。这不适合我。
有没有办法只针对特定线程?
我对此表示怀疑。由于线程共享大量资源(地址空间等),因此很难设想一种实用的机制来执行您所要求的操作。您最好的选择可能是在单独的进程中运行不受信任的代码。