my question, similar to
why java security manager doesn't forbid neither creating new Thread() nor starting it?
I'm writing a didactic application, where students are allowed to submit java code that perform certain tasks, and interact with each other.
We need to safely load, compile and execute some code.
Using the Java tools we can complete the compilation of the code all in memory; then a custom class loader load the code, and the code is executed in a thread, with a certain time out, and with a custom security manager.
However, is still possible for the students to create Threads in their code, set them in loop and eventually exhaust the System/Tomcat resource.
Is there a way to prevent the creation of threads? the cited answer said:
"""From your perspective, just change the policy."""
What that means in practice?
I tried to override methods checkPermission(Permission) and checkAccess(ThreadGroup) but i'm still unable to intercept Thread creation/start