Forbid thread to spawn new child threads

K

Kirill

Guest
I have background Runnable job which is running in separate thread:

Runnable job = () -> {
// do something
};
Thread thr = new Thread(job);
thr.start();


This job running some external code from jar, this code should not spawn new threads by requirements.

Is it possible to enforce this verbal rule and forbid to start new child threads from thr thread? It would be great if Thread.start() will throw some exception in that case.

Continue reading...
 
Top